Jonathan Sternberg
Jonathan Sternberg

Reputation: 6647

Are there any fully conforming C++ implementations?

So I was trying out some features of C++0x using GCC, but I also wanted to make sure the code could be compiled with a standard C++ compiler. So I was playing around with the __cplusplus macro with ifdefs to exclude C++0x code when it wasn't asked for.

I found that the value of __cplusplus wasn't 199711L, it was 1! After a little bit of googling, I found this where it says GCC isn't a fully conforming implementation.

Are there any fully conforming implementations? I know of clang, gcc, and msvc. GCC isn't a fully conforming implementation, are clang and msvc?

Upvotes: 3

Views: 1693

Answers (3)

nahano
nahano

Reputation: 3835

It is unlikely that any compilers other than Comeau will be fully compliant in the near future due to the prohibitive complexity of implementing the export keyword. For reasons why, see Why We Can't Afford Export.

Upvotes: 3

GManNickG
GManNickG

Reputation: 503765

No. It's possible to have a conforming compiler, but the language is extremely complex. There are corner-cases, ambiguities, and sometimes outright contradictions in the language that compiler writers struggle to get working.

The best way to make sure your code is standards-compliant is to brain-compile it, because you can verify things match the standard. Of course, this hinges on your ability to fully understand the standard; and whether or not any person can do that is an entirely new question. ;)

Upvotes: 4

Jeffrey Faust
Jeffrey Faust

Reputation: 634

I believe Comeau is fully conforming. They even implemented template export.

And what's more, you can try it online, which sounds like it would help with what you're working on.

Upvotes: 4

Related Questions