[fpc-pascal] Conditional compilation using {$IFOPT ...} and {$IF OPTION(...)}

LacaK lacak at zoznam.sk
Thu Aug 26 07:28:26 CEST 2021


Hello,
looking at 
https://www.freepascal.org/docs-html/prog/progsu126.html#x139-1400002.4.1

There is mentioned "OPTION(opt)" with comment: "evaluates to TRUE if a 
compiler option is set (mode MacPas only). It is equivalent to the 
{$IFOPT } directive."

1. What is equivalent usage for {$IFOPT R+}?
{$IF OPTION(R)} ?

2. What means comment "(mode MacPas only)"?
It will does not work for example for ObjPas mode? In my case 
Compilation fails ... (with single {$IF OPTION(R)} ) -> Error: Compile 
time expression: Wanted Boolean but got AnsiString at IF or ELSEIF
Can this OPTION be enabled for all modes?

3. Is there way how to do OR with {$IFOPT}?
if I use {$IF OPTION(R) OR OPTION(D)}  I get: "Error: Compile time 
expression: Wanted Boolean but got AnsiString at IF or ELSEIF" ...
So is there way how to do it with {$IFOPT R+D+}?

Thanks
-Laco.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210826/227b6532/attachment.htm>


More information about the fpc-pascal mailing list