[fpc-devel] Compiler bug in macro handling?
Michael Van Canneyt
michael at freepascal.org
Wed Apr 12 19:51:27 CEST 2017
On Wed, 12 Apr 2017, Giuliano Colla wrote:
> Hi honourable fpc developers!
>
> I found a strange error (both with fpc 2.6.4 and fpc 3.0.0, in Linux
> environment)
>
> The following snippet of code:
>
> {$MACRO ON}
> {$define Positiva:=False;}
> {$define Negativa:=True;}
> .......
> if HDCOUNT0 >= COUNT0 then V_PIU0 := Positiva
> else V_PIU0 := Negativa;
>
> gives rise to a Fatal: syntax error: ";" expected but "ELSE" found.
>
> But if I change the code into:
>
> if HDCOUNT0 >= COUNT0 then V_PIU0 := False
> else V_PIU0 := True;
>
> (which IMHO should be identical) it compiles without complaining.
>
> Am I doing something wrong or it is a bug?
Try removing the semicolon:
{$define Positiva:=False}
{$define Negativa:=True}
Michael.
More information about the fpc-devel
mailing list