Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-03

Are "C style operators" default or not?

12 messages · 8 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Gennadiy Poryev

Hi all,

I’ve recently ran into weird problem with “C style operators”. Though the story is about Lazarus, I thought I better ask it here. All of a sudden, my Lazarus trunk had refused to build (http://bugs.freepascal.org/view.php?id=21571 ) and I've tracked the problem to the use of "+=" operator somewhere in the recent revisions. Apparently this is easily fixed by adding -Sc compiler option to the makefile, had it not been the fact that I seem to be the only one experiencing this issue :( How this can be? I use latest fpc trunk with no self-made modifications, and it thinks that -Sc is not the default. Please enlighten me on this.

// Gennadiy.

Reply by email

Sven Barth
to Gennadiy Poryev
Gennadiy Poryev wrote
Hi all, I’ve recently ran into weird problem with “C style operators”. Though the story is about Lazarus, I thought I better ask it here. All of a sudden, my Lazarus trunk had refused to build (http://bugs.freepascal.org/view.php?id=21571 ) and I've tracked the problem to the use of "+=" operator somewhere in the recent revisions. Apparently this is easily fixed by adding -Sc compiler option to the makefile, had it not been the fact that I seem to be the only one experiencing this issue :( How this can be? I use latest fpc trunk with no self-made modifications, and it thinks that -Sc is not the default. Please enlighten me on this.

As far as I can see from the source the default should be "not enabled".

Regards,
Sven

Reply by email

Unknown author
to Sven Barth
Sven Barth wrote 15 lines
Am 27.03.2012 07:47, schrieb Gennadiy Poryev: > Hi all, > > I’ve recently ran into weird problem with “C style operators”. Though the > story is about Lazarus, I thought I better ask it here. All of a sudden, my > Lazarus trunk had refused to build > (http://bugs.freepascal.org/view.php?id=21571 ) and I've tracked the > problem to the use of "+=" operator somewhere in the recent revisions. > Apparently this is easily fixed by adding -Sc compiler option to the > makefile, had it not been the fact that I seem to be the only one > experiencing this issue :( How this can be? I use latest fpc trunk with no > self-made modifications, and it thinks that -Sc is not the default. Please > enlighten me on this. As far as I can see from the source the default should be "not enabled".

I had the same problems.

C style operators are by default off.

Michael.

Reply by email

Juha Manninen
to Gennadiy Poryev
Gennadiy Poryev wrote 7 lines
> As far as I can see from the source the default should be "not enabled". It is fixed in Lazarus svn r36376 by explicitly specifying -Sci in makefile. Sorry for raising the question here, I didn't anticipate it to be solved so fast.

Why did it work for others, including me?
I didn't set -Sci anywhere.

Juha

Reply by email

Sven Barth
to Juha Manninen: Why did it work for others, including me? I didn't set -Sci anywhere. Juha
Juha Manninen wrote 14 lines
On Tue, Mar 27, 2012 at 11:08 AM, Gennadiy Poryev < > wrote: > As far as I can see from the source the default should be "not enabled". It is fixed in Lazarus svn r36376 by explicitly specifying -Sci in makefile. Sorry for raising the question here, I didn't anticipate it to be solved so fast. Why did it work for others, including me? I didn't set -Sci anywhere.

Maybe because as Patrick wrote the fpc.cfg file enables the C-operators.

Regards,
Sven

Reply by email

Sven Barth
to Patrick Chevalley: If you build your fpc.cfg using fpcmkcfg with the default template it add -Sgic. So C…
Patrick Chevalley wrote
If you build your fpc.cfg using fpcmkcfg with the default template it add -Sgic. So C operator, C++ inline and goto are activated.

I don't consider the config file as a base for default. While most users might use that config file there could be users that don't. Also it's perfectly legal to use fpc with "-n" which tell to compiler to not load a config ,
Sven

Reply by email

Mark Morgan Lloyd
to Gennadiy Poryev: I’ve recently ran into weird problem with “C style operators”. Though the story is…
Gennadiy Poryev wrote
Hi all, I’ve recently ran into weird problem with “C style operators”. Though the story is about Lazarus, I thought I better ask it here. All of a sudden, my Lazarus trunk had refused to build (http://bugs.freepascal.org/view.php?id=21571 ) and I've tracked the problem to the use of "+=" operator somewhere in the recent revisions. Apparently this is easily fixed by adding -Sc compiler option to the makefile, had it not been the fact that I seem to be the only one experiencing this issue :( How this can be? I use latest fpc trunk with no self-made modifications, and it thinks that -Sc is not the default. Please enlighten me on this.

Didn't see it last week compiling Lazarus trunk on x86 (32-bit) using 2.6.0.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Alexander Klenin
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 16 lines
Gennadiy Poryev wrote: > > Hi all, > > I’ve recently ran into weird problem with “C style operators”. Though the > story is about Lazarus, I thought I better ask it here. All of a sudden, my > Lazarus trunk had refused to build > (http://bugs.freepascal.org/view.php?id=21571 ) and I've tracked the problem > to the use of "+=" operator somewhere in the recent revisions. Apparently > this is easily fixed by adding -Sc compiler option to the makefile, had it > not been the fact that I seem to be the only one experiencing this issue :( > How this can be? I use latest fpc trunk with no self-made modifications, and > it thinks that -Sc is not the default. Please enlighten me on this. Didn't see it last week compiling Lazarus trunk on x86 (32-bit) using 2.6.0.

Some parts of Lazarus (TAChart for sure) enable this option at package level, to avoid accidental breakage.

Alexander S. Klenin

Reply by email

Mattias Gaertner
to Alexander Klenin
Show quoted text 21 lines
On Tue, Mar 27, 2012 at 19:30, Mark Morgan Lloyd wrote: > Gennadiy Poryev wrote: >> >> Hi all, >> >> I’ve recently ran into weird problem with “C style operators”. Though the >> story is about Lazarus, I thought I better ask it here. All of a sudden, my >> Lazarus trunk had refused to build >> (http://bugs.freepascal.org/view.php?id=21571 ) and I've tracked the problem >> to the use of "+=" operator somewhere in the recent revisions. Apparently >> this is easily fixed by adding -Sc compiler option to the makefile, had it >> not been the fact that I seem to be the only one experiencing this issue :( >> How this can be? I use latest fpc trunk with no self-made modifications, and >> it thinks that -Sc is not the default. Please enlighten me on this. > > > Didn't see it last week compiling Lazarus trunk on x86 (32-bit) using 2.6.0. Some parts of Lazarus (TAChart for sure) enable this option at package level, to avoid accidental breakage.

New Lazarus packages use -Sgic by default since the beginning. So I guess the biggest part of Lazarus packages use them.

Mattias

Reply by email

Mark Morgan Lloyd
to Sven Barth: I don't consider the config file as a base for default. While most users might use that…
Sven Barth wrote 6 lines
Am 27.03.2012 10:16, schrieb Patrick Chevalley: > If you build your fpc.cfg using fpcmkcfg with the default template it > add -Sgic. > So C operator, C++ inline and goto are activated. I don't consider the config file as a base for default.

In the specific case of FPC, I agree.

In the general case, I agree except for cases where a configuration file is signed/checksummed so as to be intimately associated with the binaries.

While most users might use that config file there could be users that don't.

Although once FPC's been installed as a binary on a given system a tailored fpc.cfg will exist, so it's very easy to forget about it when subsequently building from source.

Also it's perfectly legal to use fpc with "-n" which tell to compiler to not load a config in this case you'll fairly rapidly have problems with some of

the system libraries. In general fpcmkcfg etc. does a sterling job of working out where everything is, although I had a bit of grief with this with Solaris a year or so ago.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email