[fpc-pascal] $modeswitch from command line
Mr Bee
pak.lebah at yahoo.com
Wed Feb 5 10:45:54 CET 2020
It’s a great info, Jonas. Thank you.
I didn’t know FPC has -M option for $modeswitch. Based on the official document¹, the -M option is to select language modes, not language features.
I know changing language mode would reset mode switches. It’s no problem for me because I wrote the code and I stick to ObjFPC mode for all the code, no exception. But I want to use advanced record feature as well. By setting the language mode and language features in the global config, I don’t need to write them in every single file.
–Mr Bee
_____¹ A Alphabetical listing of command line options
|
|
| |
A Alphabetical listing of command line options
|
|
|
Pada Rabu, 5 Februari 2020 02.30.04 WIB, Jonas Maebe <jonas at freepascal.org> menulis:
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
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200205/c913f6ea/attachment.html>
More information about the fpc-pascal
mailing list