[fpc-devel] Compiler bug in macro handling?
Bernd Oppolzer
bernd.oppolzer at t-online.de
Wed Apr 12 20:26:58 CEST 2017
No,
if you put a semicolon in there, you will get wrong syntax,
no matter what the datatype is.
Example:
{$MACRO ON}
{$define Fifteen:=15;}
{$define Twelve:=12;}
.......
if HDCOUNT0 >= COUNT0 then X := Fifteen
else X := Twelve;
will generate this Pascal statement:
if HDCOUNT0 >= COUNT0 then X := 15;
else X := 12;
and the semicolon before the else is wrong in Pascal syntax.
Remember: $define (macro processing) is stupid text replacement ...
HTH,
Bernd
Am 12.04.2017 um 20:11 schrieb Giuliano Colla:
> Il 12/04/2017 19:51, Michael Van Canneyt ha scritto:
>> Try removing the semicolon:
>> {$define Positiva:=False}
>> {$define Negativa:=True}
>
> Without semicolon it works!
>
> Thanks a lot.
>
> BTW, do you think that this holds true only for the define of boolean
> values?
>
>
> _______________________________________________
> 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