[fpc-devel] Compiler bug in macro handling?

Giuliano Colla giuliano.colla at fastwebnet.it
Wed Apr 12 19:39:41 CEST 2017

Hi honourable fpc developers!

I found a strange error (both with fpc 2.6.4 and fpc 3.0.0, in Linux 

The following snippet of code:

{$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?


More information about the fpc-devel mailing list