Why isn't this syntax valid on Windows? Very confused.
============================
{$mode objfpc}
program WindowsTest;
var
s: String;
begin
s += ';'; // Syntax error, ";" expected but "const char" found
end.
Mailing lists / fpc-pascal / 2021-10
7 messages · 5 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Why isn't this syntax valid on Windows? Very confused.
============================
{$mode objfpc}
program WindowsTest;
var
s: String;
begin
s += ';'; // Syntax error, ";" expected but "const char" found
end.Because += is a mistake and hopefully it's irreparably broken.
Does using just s:=s+';'; work?I thought they were behind a mode switch called "c operators" or something but either way I don't see why Windows would disable them. They're all over my program which runs on macOS and I don't want to remove them (like that operator myself).
Regards,
Ryan Joseph
Ryan Joseph wroteI thought they were behind a mode switch called "c operators" or something but either way I don't see why Windows would disable them.
The compiler itself does enable them by the default on any platform. However, the fpc.cfg file that gets installed with FPC on all platforms does enable them by default (it contains -Sgic). Compile with -vt and check where the compiler is getting its configuration file from.
Jonas
Jonas Maebe via fpc-pascal schrieb am
So., 31. Okt. 2021, 08:54:
Jonas means "does NOT enable" here.
However, the fpc.cfg file that gets installed with FPC on all platforms does enable them by default (it contains -Sgic). Compile with -vt and check where the compiler is getting its configuration file from.
Regards,
Sven
The compiler itself does enable them by the default on any platform. However, the fpc.cfg…
On Oct 31, 2021, at 2:53 PM, Jonas Maebe via fpc-pascal wrote: The compiler itself does enable them by the default on any platform. However, the fpc.cfg file that gets installed with FPC on all platforms does enable them by default (it contains -Sgic). Compile with -vt and check where the compiler is getting its configuration file from.
Thanks, I see -Sc now but I've always taken for granted it was always there. What confused me is that it's a command line option instead of a mode switch like other language features.
Regards,
Ryan Joseph
It's simply a separate directive: $COperators. The advantage of having it (and some others) separate is that any mode directive in the source will reset any modeswitches that were set on the command line.
Regards,
Sven