[fpc-pascal] Precedence of compiler switches/directives
Michael Van Canneyt
michael at freepascal.org
Thu Oct 8 11:08:51 CEST 2020
On Thu, 8 Oct 2020, Peter via fpc-pascal wrote:
> I'm curious about who wins, if switches/directives are set to different values in different places.
> They could be set in
> fpg.cfg
> Command line or Lazarus lpi
> Directives in the code.
>
> Is there some AND/OR logic, or is it a strict precedence order? Is it the same for all switches?
> I can see for example that some switches can be turned on but not off at the command line.
>
> I gather command line options take precedence over fpc.cfg, but what about directives in the code? If a directive says
> range checks off, but the command line and/or fpc.cfg says range check on, what happens?
The directive wins.
>
> I assume that as directives can be set to different values in different parts of the code, that they must have the
> highest precedence. Is this correct and always the case?
I think the rule is best summarized as: The last set value always wins.
That's why the order of options in the command-line is important.
Michael.
More information about the fpc-pascal
mailing list