[fpc-pascal] $modeswitch from command line

Jonas Maebe jonas at freepascal.org
Tue Feb 4 20:29:39 CET 2020


On 04/02/2020 10:06, Mattias Gaertner via fpc-pascal wrote:
> As Sven explained a $mode resets all modeswitches.
> What you need is a switch to alter modeswitch of a mode. And
> there is currently no such switch.
> 
> For example a syntax could be:
> -MObjFPC+AdvancedRecords+AnsiStrings-NestedComments

$ cat tt.pp
program x;

{{test }

type
  tr = record
    procedure test;
  end;

  procedure tr.test;
    begin
    end;

begin
  writeln(sizeof(string));
end.

$ fpc -MObjFPC -Madvancedrecords -Mansistrings -Mnestedcomments- tt
Free Pascal Compiler version 3.0.4 [2018/09/30] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Darwin for x86_64
Compiling tt.pp
Assembling (pipe) tt.s
Linking tt
16 lines compiled, 0.1 sec

$ ./tt
8

Setting a different mode resets all modeswitches to the default for that
mode (since that's one of the main points of a mode). Setting a
different modeswitch does not reset anything.


Jonas


More information about the fpc-pascal mailing list