2

I have heard that there will be a lot of changes done in C++ because of the new standard (C++0x). My question is: What are the major changes, and will C++0x be compatible with C++ 98 and C ?

ApprenticeHacker
  • 1,373
  • 1
  • 18
  • 27
  • C has compatability with C++. That is, valid C code (to some measurable extent) is also valid C++ code. C++ adds a number of features (classes come to mind) such that the reverse has never been true - it's incredibly simple to create valid C++ code that is (and has never been, and probably will never be) valid C code. – Thomas Owens Aug 15 '11 at 12:42
  • Which C do you talk about ? C90 ? C99 ? C with gnu extensions ? I think it will be almost fully compatible with C90. – BenjaminB Aug 15 '11 at 12:52
  • @Ubiquité What do you mean by "fully compatible with C90"? There's no way I could take any meaningful C++ application and compile it with a C90 compiler. It's just not happening, as C++ added a number of new features. Even with compatibility, it's not a 1-1 mapping. See: http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B – Thomas Owens Aug 15 '11 at 14:01
  • You can compile C90 with a C++11 compiler. – BenjaminB Aug 15 '11 at 14:20
  • @Ubiquité That means C90 is (mostly) compatible with C++11, not that C++11 is compatible with C90. Compatability in this instance is not bi-directional. – Thomas Owens Aug 15 '11 at 14:34
  • But with your definition "fully compatible" means equal. But that's ok for me ^^ – BenjaminB Aug 15 '11 at 15:20

3 Answers3

8

C++0x now is named C++11.

Since C++ never was compatible with C, i doubt that C++11 will be.

As for compatibility with C++ 98, have a look at the ISO standard for C++11.

Rommudoh
  • 412
  • 2
  • 7
  • 4
    C++0x isn't quite C++11. It has been approved, but not published. If it is published next year then it will be C++12. Let's hope we don't have to wait that long :-) – Peter Alexander Aug 15 '11 at 12:53
1

Neither C++ (98) nor the new standard are fully compatible with C. Annex C of the C++ standard identifies areas in which C++ is incompatible with C. The annex is 14 pages long in both the old (98) and new (0x) versions of the standard.

David Hammen
  • 8,194
  • 28
  • 37
0

One of the areas of work in C++0x is to improve the compatibility with C99. C++98 referenced C89. So, arguably C++0x will restore the compatibility that existed in 1998-1999, the last time current C++ was based on current C.

MSalters
  • 8,692
  • 1
  • 20
  • 32