[fpc-devel] Compiler bug in macro handling?

Bernd Oppolzer bernd.oppolzer at t-online.de
Wed Apr 12 19:54:50 CEST 2017


Hi Guiliano,

I'm no FPC macro language wizard, but in my believe
you are replacing Positiva with False, followed by a semicolon,
and so you get the error from the compiler.

{$define Positiva:=False}

should probably work.

HTH,
kind regards

Bernd


Am 12.04.2017 um 19:39 schrieb Giuliano Colla:
> 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?
>
> Giuliano
>
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel




More information about the fpc-devel mailing list