__gnu_cxx error in OpenSolaris

Dr. David Kirkby david.kirkby@onetel.net
Fri May 20 07:00:00 GMT 2011


On 05/20/11 06:23 AM, Miles Bader wrote:
> "Dr. David Kirkby"<david.kirkby@onetel.net>  writes:
>>> Stick with GCC and you will be happy.
>>
>> That's if you want to write in GNU C++ and don't care about writing
>> standard C++ code.
>
> ... or are capable of adding a "-std=..." option.

BUT IMHO, the default should be to use the standard C++, not a set of extensions 
GCC permits.

In any case, that does not work well.

drkirkby@hawk:~$ cat test.cc
#include <iostream>
using namespace std;

int main() {
    int a=0b1111111;
    cout << a;
}

drkirkby@hawk:~$ g++ -std=c++98 -Wall test.cc
drkirkby@hawk:~$ ./a.out
127drkirkby@hawk:~$

I don't have an official copy of the latest standard, but I don't believe 0b is 
anything other than a GNU extension.

http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html

> Even if there were no
> GNU extensions at all, one would usually need to think about this, as
> the differences between various standard dialects are significant.
>
> [Even by default, though, g++ is of vastly _vastly_ more
> standards-conforming than, e.g., Microsoft's C++ compiler...]
>
> -Miles

I use gcc a lot, but I'm not impressed with it.

Dave



More information about the Gcc-help mailing list