Does G++ follow 98 standard?
Does G++ follow 98 standard?
Is G++ follow 100% of 98 compliance or does it not follow some obscure features of the standard???I'm pretty new to C++ from C and I know gcc is like 100% for C90 standard.I'm just asking because i hear C++ compilers are generally less compliant.
G++ is rather 99% compliant (as of 4.3.0). IT does not support the export keyword properly. There are also probably one or two other minor issues that don't work quite well.
MSVC is about 98% compliant (as of 8.0, haven't tried 9.0); it makes a few more mistakes than GCC but not that much. I personally have only hit one fairly large thing, it doesn't support a copy constructor from const and a copy constructor from non-const reference in one class.
There are compilers that are more compliant, but they're far from common. I believe Comeau's compiler is the most well-known compiler to support export.
C99 is the best in GCC. MSVC explicitly doesn't support it and doesn't support the features (VLA), the headers (inttypes.h) and so forth.
As for c++0x, that's another story. MSVC doesn't do any yet as far as I know. GCC has an experimental mode in 4.3 but it has bugs because it's the first release to have it. Just yesterday evening I had a discussion with bluecode as
doesn't compile, but if you insert a space between the two >'s, it does work. There's supposed to be a C++0x change that makes it work with the two joined together.
MSVC is about 98% compliant (as of 8.0, haven't tried 9.0); it makes a few more mistakes than GCC but not that much. I personally have only hit one fairly large thing, it doesn't support a copy constructor from const and a copy constructor from non-const reference in one class.
There are compilers that are more compliant, but they're far from common. I believe Comeau's compiler is the most well-known compiler to support export.
C99 is the best in GCC. MSVC explicitly doesn't support it and doesn't support the features (VLA), the headers (inttypes.h) and so forth.
As for c++0x, that's another story. MSVC doesn't do any yet as far as I know. GCC has an experimental mode in 4.3 but it has bugs because it's the first release to have it. Just yesterday evening I had a discussion with bluecode as
Code: Select all
template <typename A>
class B {};
template <typename C
class D {};
B<D<void()>> some_var;
Re: Does G++ follow 98 standard?
If you are looking for full compliance, your choices are limited. To my knowledge, only the EDG compiler frontend (also powering the Comeau compiler) in combination with the Dinkumware libraries gives you that (bugs nonwithstanding).Pinkfloyd wrote:Is G++ follow 100% of 98 compliance or does it not follow some obscure features of the standard???
Don't know about C90, but it's still lacking in some places for C99. (Too bad there doesn't seem to exist such a table for C++...)...I know gcc is like 100% for C90 standard.
Last edited by Solar on Mon Jun 02, 2008 3:55 am, edited 1 time in total.
Every good solution is obvious once you've found it.
That's often cited as the biggest grammar ambiguity in C++. The lexer treats the two >'s as ">>", which is a right shift.As for c++0x, that's another story. MSVC doesn't do any yet as far as I know. GCC has an experimental mode in 4.3 but it has bugs because it's the first release to have it. Just yesterday evening I had a discussion with bluecode asdoesn't compile, but if you insert a space between the two >'s, it does work. There's supposed to be a C++0x change that makes it work with the two joined together.Code: Select all
template <typename A> class B {}; template <typename C class D {}; B<D<void()>> some_var;
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
It's probably the second biggest grammar ambiguity. #1 IMO is C++'s most vexing parse as described by Scott Meyers in his book "Effective STL". In a nutshell, sometimes an expression that declares a local variable and calls a constructor on it in a single line looks syntactically like a function definition.JamesM wrote:That's often cited as the biggest grammar ambiguity in C++. The lexer treats the two >'s as ">>", which is a right shift.
Top three reasons why my OS project died:
- Too much overtime at work
- Got married
- My brain got stuck in an infinite loop while trying to design the memory manager
The point of my comment was, c++0x explicitly says "the >> without space now *works* and the compiler writer will do whatever it takes to make it work". GCC still doesn't work though.JamesM wrote:That's often cited as the biggest grammar ambiguity in C++. The lexer treats the two >'s as ">>", which is a right shift.As for c++0x, that's another story. MSVC doesn't do any yet as far as I know. GCC has an experimental mode in 4.3 but it has bugs because it's the first release to have it. Just yesterday evening I had a discussion with bluecode asdoesn't compile, but if you insert a space between the two >'s, it does work. There's supposed to be a C++0x change that makes it work with the two joined together.Code: Select all
template <typename A> class B {}; template <typename C class D {}; B<D<void()>> some_var;
I quite agree on the most vexing parse.