Author Topic: misbehaviour in general compiler flags  (Read 4804 times)

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
misbehaviour in general compiler flags
« on: May 21, 2015, 04:49:46 pm »
Hi everybody,

I am not sure, but I think there is an error in the dialog page compiler settings -> compiler flags -> general when having selected a gnu compiler. There are four general flags:

-std=c++98
-std=c++11
-std=c++0x
-ansi

The first three are mutually exclusive, as is to be expected. But the -ansi flag can be set with any of the other three set.

Or at least change the text of the flag indicating that it only makes sense when using C++98 standard.

Setting the -ansi flag with either -std=c++11 or -std=c++0x flag will result in errors while compiling code using C++11 features. According to the gnu description, the -ansi flag only makes sense with the -std=c++98 flag. It seems, that the -ansi flag really refers to a standard (the ansi standard) from 1998, with -std=c++98 ISO standard being roughly equivalent. There was no C++ ansi standard after 1998.

C++11 and C++0x have features which are incompatible with ansi C++ from 1998.

Wouldn't it be better, the -ansi flag were only combinable with the -std=c++98 flag? Or only settable when -std=c++98 were set?

I know, that an experienced programmer wouldn't have any need for this, but then he won't have need for the mutual exclusiveness of the other three flags either, knowing that the compiler will only take into account one, which will be always the last given to the command line...

As a little bit off (my own) topic: shouldn't there be the equivalent gnu flags (which may have non standard C++ extensions) in the dialog too:

-gnu=c++98
-gnu=c++11
-gnu=c++0x

And yes, I know that these are non standard and to be avoided, and that an experienced programmer would just put them into compiler options by hand if he wanted them... but that would be the same for all compiler options, wouldn't it?

Regards

frithjofh
« Last Edit: May 21, 2015, 07:18:42 pm by frithjofh »
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: misbehaviour in general compiler flags
« Reply #1 on: May 25, 2015, 09:13:10 am »
You can adapt this yourself by right clicking in the compiler options and change or add flags as needed.if you have done that provide us with the changes.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ