[fpc-pascal] $modeswitch declared before $mode fails without warning

Florian Klämpfl florian at freepascal.org
Sun Sep 18 14:37:17 CEST 2022


Am 18.09.22 um 14:22 schrieb Hairy Pixels via fpc-pascal:
> One more thing today working with closures. Declaring the modeswitch before the mode does not actually enable the feature and gives no warning. What happens then is basic syntax fails and you’re totally confused as to why.
> 
> Shouldn’t this be illegal or give a warning at least?
> 
> {$modeswitch functionreferences}
> {$modeswitch anonymousfunctions}
> {$mode objfpc}

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.

> 
> program test;
> var
>    p: reference to procedure;
> begin
> end.
> 
> Regards,
> 	Ryan Joseph
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal



More information about the fpc-pascal mailing list