[fpc-pascal] mode switch madness

Michael Van Canneyt michael at freepascal.org
Fri Apr 12 16:48:12 CEST 2019



On Fri, 12 Apr 2019, Ryan Joseph wrote:

>
>
>> On Apr 12, 2019, at 10:15 AM, Michael Van Canneyt <michael at freepascal.org> wrote:
>> 
>> That would break with the rule that directives do not cross unit boundaries.
>> It has far-reaching consequences.
>> 
>> Better introduce a command-line switch to set mode switches.
>
> But is it maybe time we reconsider this or add an extension? It’s really getting out of hand now.

I really don't think we should reconsider this.
Locality is a good rule. It keeps things predictable.

Maybe you're just using the wrong combination of options ? 
I don't have a single project where I have to use modeswitches.

> Problem with compiler switches is that they’re decoupled from the program
> itself and not documented in the actual programs source code.  Honestly
> I’d prefer all compiler switches be stored in the program file so we
> didn’t have distribute extra files that contain command line arguments.

What happens if you have a third-party unit that is aversely affected by the
settings in your program ? I don't think this is a good idea.

So, I'd prefer to keep things local.

You can do a

{$i mysettings.inc}

if you really need that many options. The effect is the same.

Michael.


More information about the fpc-pascal mailing list