You must have to be familiar with C++ program, before reading this advanced C++ concepts. Most of the C++'s advanced Standard Library and features are based on concepts which are further added to make C++ language more flexible and strong. In this chapter, you will be given a brief introduction of how the history of Standard C++, (which comes after intermediate C++ level) came into existence and its compatibility with older version of C++.
History of the C++ Standards
The standardization or different versions of C++'s development was started in the year 1989 by the International Organization for Standardization (ISO). ISO is a committee of national standards organizations like that of ANSI in the United States. IN standardizing the C++, this work has resulted in four milestones or you can say four objectives were reached that is more or less C++ standards which available on different platforms throughout the world. These are:
- C++98: which was approved in the year 1998, was the 1st C++ standard. Its official title was Information Technology — Programming Languages — C++ and was documented with the number as:: ISO/IEC 14882:1998.
- C++03: also termed as "technical corrigendum" ("TC") that contains minor bug fixes and inherited from older standard C++98. It is having a document number as ISO/IEC 14882:2003. Hence, both versions namely C++98 and C++03 points out to the "1st C++ standard."
- TR1: This encloses library extensions for the first standard. It is having an official title as Information Technology — with Programming Languages —The Technical Report on Library Extensions of C++ and is having a document number as ISO/IEC TR 19768:2007, approved in the year 2007. This extension specified that all part of a namespace is in std::tr1.
- C++11: This got approved in the year 2011 which is the second C++ standard. C++11 has essential improvements in both the language and its library, for that reason, the extensions of TR1 have to turn out to be part of namespace standard. The certified title again is given as: "Information Technology — with Programming Languages — C++", but is initialized with a new document number which is: ISO/IEC 14882:2011.
Compatibility Between C++98 and C++11
A blueprint based goal of C++11 was that C++ language remains backward compatible with C++98. In standard, all those things which get compiled with C++98 or C++03 must compile with C++11. Still, there remain some exceptions. A good example can be - variable names cannot have the name of newly introduced keywords (of C++11) anymore. For new standard i.e. C++11, the below-mentioned definition holds when compiling a C++ translation unit like:
# define __cplusplus 201103L #define __cplusplus 199711L
It is to be noted that however, those compiler vendors at times provide different values here; that backward compatibility concerns only to that source code. It is not guaranteed that the binary compatibility will remain static which leads to troubles, particularly when an obtainable operation got a new return type as overloading by the return type only is not allowed.
So, it needs to be mandatory that compiling all parts which include the libraries also in the C++98 program with the C++11 compiler should habitually work. Linking to the code, compiled via C++11 compiler when needs to compiled using a C++98 compiler might fail. This is because of the backward compatibility of the developers of C++ compilers.