[fpc-pascal] $modeswitch declared before $mode fails without warning
Sven Barth
pascaldragon at googlemail.com
Sun Sep 18 15:49:04 CEST 2022
Am 18.09.2022 um 15:39 schrieb Hairy Pixels via fpc-pascal:
>
>> On Sep 18, 2022, at 7:37 PM, Florian Klämpfl via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>>
>> This is in general the case that $mode overrides all previously set switches i.e. it simply sets the switches as defined by the given mode so I am not sure if this is really worth a warning.
> Is there ever a time where this would be useful to put a mode switch before the mode? I always think about it like a 2 step process: 1) choose the mode and 2) add extra features via mode switches. Unless I’m missing some use case it just seems like a way to create bugs.
The thing is that it is not necessary to use a mode directive. Either
the user might be happy with the default mode FPC and just add some
modeswitch for extended functionality or the mode might be provided as a
command line parameter again with adding some special functionality.
And it would be much more effort to keep track of when a modeswitch
directive was used in case a mode directive is used later on. Just not
worth the effort as it's documented that a mode directive resets any
modeswitches.
Regards,
Sven
More information about the fpc-pascal
mailing list