How much does the GCC compilers keep to the C/C++ standards?

For example, the C programming language with C99 standard supports hexadecimal floating-point literals but the C++ with C++03 standard doesn't.

I tested it, GCC recognized the hexadecimal floating literal in C++03 mode (-std=c++03) but according to the C++ standard, it shouldn't. I know, it's not a tragedy, I'm just interested in this question..

Does the GCC compilers conform to the standards? Can you recommend me a C/C++ compiler that conforms to the standards "perfectly"?


When you give a standard to the GCC, according to the manual the

compiler will accept all programs following that standard and those using GNU extensions that do not contradict it.

If you want to ensure strict adherence to the standard, add -pedantic , which will warn about hex FP literals.


The Comeau compiler, using its own libcomo standard library, is about as close to perfect C++03 support as you can get.

For C++11 Clang with libc++ and GCC with libstdc++ are both pretty good, but not perfect (yet)

链接地址: http://www.djcxy.com/p/86362.html

上一篇: 强制编译器为C99标准

下一篇: GCC编译器对C / C ++标准保持多少?