Last time I tried to use C++ several years ago I remember having to include different libraries between different IDEs even though I was using the same operating system, which left me somewhat confused about the C++ language.
Are there different standardizations of the C++ language? And if so, what branches of the language exist out there? Is the syntax and/or library names for each standardization different between operating systems? Also, What is primary standardization used nowadays?
6
The biggest place I’ve seen this is with C++11, which included most of the Technical Report 1 libraries. For example, to access the hash table (unordered_map
), you used to have to #include <tr1/unordered_map>
and it was in the namespace std::tr1
. Now, you just leave the tr1 off of both.
The C++ standard has been revised several times, the most recent being C++11, C++03, and C++98. However, few compilers implement the full spec in one release, so different releases of different compilers support different parts of the spec. Plus, since the spec is written in a natural language (English), it has ambiguities, and corner cases can be handled differently by different compilers.
Similarly, in one implementation of the standard library, #include <vector>
may automatically #include <algorithm>
, whereas in another, it may not. So in one implementation, you might be able to get away with using the methods in algorithm
without including it, even though your program does not technically conform to the C++ spec.
As for the primary standardization, if you’re starting a project from scratch now, you should use C++11 and the latest stable release of your favourite compiler. Not all features are fully implemented by all compilers, but e.g. you should use unique_ptr
instead of auto_ptr
, use (simple) lambdas, and the auto
keyword where it improves readability.
1
There are no actual branches of the language. However, the language standard library is very minimalistic in comparison to many other popular languages like C#, Java or Python. This could very well give an impression of the language being branched, or even chaotic because in order to use higher-level functionality found in other languages such as threads(*) or HTTP facilities, the programmer has to rely on external libraries which are not found in the standard library. As such the programmer is directly dependent on external providers, rather than simply sticking with what the language provides by default.
(*) C++11 includes standard thread facilities, as such there’s often no absolute reason to rely on external library such as Boost for threads.
The most correct answer, as far as i know, for your question is: none.
Because a language is a language with or without some headers or some libraries, you can see the most common libraries such as the standard library or the boost library as commodities in your workflow but the language itself does not require them; all you need to code is a text editor and a compiler.
If you can be more specific about this, it would help to answer in a better way but in general it depends on:
- what technologies you want to use in your project ( basically what libraries )
- what kind of build you want to produce and which compiler are you using, for example some compilers and libraries offers specific macros
Regarding the latest versions of the language, the C++ 11, it was a draft for something like 1 year and was recently approved, some books will be published soon about this topic, but i don’t think that we will see C++ 11 in a productive environment soon; the modern C++ is more oriented to meta-programming, a feature like the ability to use templates, is really popular these days and to give you an idea the templates were introduced in the late 90’s. The adoption on large scale is slow, you can study from a book or a resource from 5-10 years ago and have good chance to become a modern developer.
You can read about c++ in c++ wiki.
Are there different standardizations of the C++ language? And if so, what branches of the language exist out there?
There are 3 major versions of c++ : c++11, c++03 and c++98.
c++11 is the latest version, and there are features are still not supported in compilers.
Is the syntax and/or library names for each standardization different between operating systems?
No, c++ has the same syntax defined by ISO document (ISO/IEC 14882:2011 for c++11). What differs between OSes is support for various features between compilers on these OSs, and their bugs.
Also, What is primary standardization used nowadays?
That depends on the available compiler, it’s features and the organization where you work. Some compilers (like for example TI’s c++ compiler) supports only c++98. Some organizations are slow in making big changes (like changing compiler version) and do not allow c++11 features.