[fpc-devel] Unreachable code warnings

Daniël Mantione daniel.mantione at freepascal.org
Sun Oct 14 22:06:50 CEST 2007

Op Sun, 14 Oct 2007, schreef Micha Nelissen:

> Daniël Mantione wrote:
> >> A warning should always be fixable and doing so, turning it into correct
> >> code. The compiler is simply wrong here; my code is correct, so it
> >> should not complain.
> > 
> > The warning is fixable: Remove the superfluous check.
> Sigh. That's my point. If you were using smallint before, and someone
> changes the type to integer, then a bug is introduced; so you don't want
> to remove the check but the compiler can of course optimize it away.

A solution is to make a dedicated type, and write down comments near its 

If you remove the warning, code like:

if a>high(a) then

... no longer warns, which results in dead code in many situations.

I can follow your reasoning why you want the dead code, but on the other 
hand the warning is there with good reason.


More information about the fpc-devel mailing list