__gnu_cxx error in OpenSolaris

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


On 05/19/11 09:09 PM, Jonathan Wakely wrote:
> On 19 May 2011 20:03, David Kirkby<david.kirkby@onetel.net>  wrote:

> I thought we were talking about C++ (my first clue was the subject of
> the thread and your mention of "GNU C++")

> Throughout your reply you only refer to C, which I'm not qualified or
> interested enough to comment on.

But for many practical purposes C++ is a superset of C, so g++ inherits the same 
GNUims as gcc.

For example:

#include <iostream>
using namespace std;

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

compiles with g++, but is not valid C++.

There's not even a warning if -Wall is used

drkirkby@hawk:~$ g++ -Wall test.cc
drkirkby@hawk:~$

The Sun compiler quickly identifies this as invalid C++ code.

drkirkby@hawk:~$ CC test.cc
"test.cc", line 5: Error: 0b is not a valid constant.
"test.cc", line 5: Error: Badly formed expression.
2 Error(s) detected.

> I'm very interested in making G++ conform to the C++ standard as well
> as possible and only objected to the assertion that G++ users don't
> care about writing standard C++.

My point is the GNU compilers allow constructs which are not standard. Anyone 
starting a C++ project and wishing for it to be standard C++, should not use g++.

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?



More information about the Gcc-help mailing list