Greetings

As the titles says I wanna know what are versions of C++ other than Standard C++ and what are the differents between those version if any!

Second question what is contained in the .exe file I'm using Microsoft compiler "Visual Studio 2010 IDE"? Is it contains the assembly instructions? if not so what is the content within the .exe file and what is the exact steps of compiling a C++ code after writing it (in detail) specially the linker part?

Thanks in advance

Recommended Answers

All 7 Replies

As the titles says I wanna know what are versions of C++ other than Standard C++ and what are the differents between those version if any!

Every compiler offers extensions to both the language and the library, but you can generally say that the different "standards" of C++ are as follows:

  • ARM Standard: Compilers released earlier than 1998. They may or may not conform to some parts of C++98 due to how long it takes to release a standard document. The de facto standard at the time was defined by The Annotated C++ Reference Manual (called the ARM).
  • ISO C++98: The first official international standard. When a compiler says it conforms to C++, it must at least be C++98.
  • ISO C++03: Minor wording changes and fixes to the 1998 standard in 2003.
  • C++0x: Intermediate support between C++03 and C++11 of C++11 features while they were in development.
  • ISO C++11: The final and most current standard released in 2011.

Second question what is contained in the .exe file I'm using Microsoft compiler "Visual Studio 2010 IDE"?

It contains stuff necessary for the OS to load and run your program such as certain variable definitions, data, instructions for executable code, and library references.

You meant that earlier than 1998 there were no standards to the language. What are meant by standards in fact! Is it mean the structure of C++ syntax, how to define variables, how to create class, structure etc, name of data types like int, double etc, memory allocated for each data type. Is that what it means by standard?

As the titles says I wanna know what are versions of C++ other than Standard C++ and what are the differents between those version if any!

The first "version" has to be the ARM (around 1990-1991). This wasn't an official, formal standard document, but the later editions were essentially the working draft for the standard in 1998. This pre-98 version of C++ is what is generally referred to as "pre-standard C++". The language changed quite a bit from 1985 to 1998, so it cannot be defined in clear terms what exactly was or wasn't in it. It basically goes a bit like this. The core addition to C from the start was classes, that is, the extension of C-style "struct" to include member functions, inheritance, the private/public/protected scopes, and all those kinds of classic object-oriented programming features, and probably also things like const, references, function overloading, etc., the things that weren't part of C but were well established in other new languages of the time. Then, during the 90s, the more exciting stuff was introduced, such as exceptions, templates, namespaces, and, of course, the main components of the standard library that we could hardly live without today, like STL containers and algorithms, and the IO-stream library. Another noticeable difference between standard and pre-standard C++ is the fact that pre-standard headers had the .h extension (as in #include <iostream.h> or <math.h>, as opposed to today's <iostream> and <cmath>), and the elements (classes and functions) of the standard library were in the global namespace (as opposed to today's std namespace). That's a telltale sign of pre-standard code.

In 1998, all of this came to fruition and formed an official ISO standard definition of the C++ language. A standard document means that virtually every conceivable detail of the language is explained, from syntax rules to the observable behavior of the code, you can take a look at the latest draft to see what it looks like, it is essentially a legal-style document, not an easy read, highly technical but in details and in vocabulary used. And that is basically "standard C++". The 2003 version is really just a set of minor revisions, nothing much to talk about. Today, people will often use the terms "standard C++", "C++98", "C++03", or "C++98/03" interchangeably (although "standard C++" today should technically mean C++11, it will take a little while before that sets in, and it will take a bit more wide-spread compiler support for it too). So, C++98/03 is the familiar full-featured C++ that most books talk about and most code is written in today.

Then, as of 2011, there is a new ISO standard, C++11. The differences are quite many. Most notably, move-semantics (through rvalue-references), variadic templates, a number of syntax-sugar (auto, range-based for-loops, lambda functors, etc.), and language support for multi-threading, and of course, many nice additions to the standard library, like multi-threading facilities, better date-time functionalities, more elaborate random-number generators, nice smart pointers, and much more. The wiki page has a pretty good overview.

Then, there is also the TR1 library (Technical Report 1) in 2007, which included some extensions to the standard library. You would find those in the std::tr1 namespace on most compilers that aren't ancient.

In the embedded systems world, there are also some reduced versions of C++ which usually work off the 1998 standard and strip away the things that aren't appropriate in resource-deprived areas like embedded systems. A prominent example is the Embedded C++ standard which more or less takes C++ back to how it was in 1990 or so, cutting all the fat. EC++ cuts out exceptions, run-time type identification (RTTI) (what you need to use dynamic_cast or typeid), templates, and most of the standard library, if not all (I'm not too familiar with this). I think that most compilers will allow you to optionally turn on some of these features, if you can accept the overhead that they cause (mostly in code bloat (size of compiled executables)). But there is a lot of variability in this domain, between arduino, Atmel, and other brands that support different compilers and different subsets of C++ and its libraries.

Another important aspect of this discussion on different "versions" of C++, is also the fact most compilers, depending on when, where and by who, are rarely entirely standard-compliant. Most compilers have a number of little quirks and often take short-cuts in certain darker areas of the standard. The C++ language is complex and has lots of "rules", and writing a good compiler that plays by all those rules is sometimes difficult, let alone being sure of what the rules actually mean in every conceivable corner-case. Long story short, large, complex and wide-spread libraries, such as Boost, must have lots of little work-arounds to please one compiler or another. And then, there are deliberate dialects too. Generally, we would speak mostly of the GNU dialect and the Microsoft dialect. These dialects are most about some liberties taken by the compiler vendors to allow certain things that are usually allowed by the standard (explicitely or implicitely). Most compilers have options to turn off those extensions or additional permissions. In practical terms, people sometimes have been programming for a long time with one compiler, and sometimes get surprises when they see that it doesn't compile with another, because they were using language extensions without knowing (most notably, GCC has C library stuff in both the std namespace and the global namespace, while other compilers like Clang or MSVC have them only in the std namespace, both are allowed by the standard, but many get a bit of a surprise from that).

What are meant by standards in fact!

Essentially, standards are a complete enough description of the language and library (syntax, semantics, limitations, etc...) to write a compiler. Without standards, each compiler would define its own unique dialect of the language, which would mean you can't take code from one compiler and expect it to compile on another. With standards, as long as your code conforms to the rules laid out by the standard, you can compile your code on any conforming compiler.

Like what Mike2K said. That said (sic), the nice thing about standards... is that there are so many! :-)

And FWIW, Microsoft's compilers are usually quite far behind the current set of standards... :-(

Thanks guys especially "mike_2000_17" thanks for your reply it seems I need to read more a on this topic.

Is there good and bad type of compiler? or wording of the question is incorrect!

Is there good and bad type of compiler? or wording of the question is incorrect!

Good / bad is too vague, it depends too much on what you want: faster code, faster compilations, wider platform support, better value for your money, better debugging tools, stability, standard compliance, etc...

The main C++ compilers are GCC (open-source from GNU), ICC (proprietary from Intel), MSVC (proprietary (but free) from Microsoft), and Clang/LLVM (open-source from Apple and Google and others). There are also a few others like C++Builder (Borland -> Embarcerado) and IBM's XL compiler. Each of them have different qualities and marketing points. Also, most are split between front-end (that parses the code) and back-end (that generates the executable code), and those can be crossed (e.g., GCC front-end with LLVM back-end, or Clang front-end with GCC backend, or EDG front-end with ICC back-end). And then, there are the standard library implementations, which are mainly the GNU implementation (libstdc++), the LLVM implementation (libc++), and the Dinkumware implementation (proprietary) (used by Microsoft, IBM, Borland, Comeau, and many others).

A broad-brush classification, in my opinion and limited knowledge, would be this: (X > Y: X is better than Y)

Faster code:
ICC >> GCC > Clang > MSVC

Faster compilation:
MSVC > Clang > ICC > GCC

Wider platform support:
GCC > ICC > Clang >>> MSVC

Debugging tools:
ICC > MSVC >> GCC = Clang

Stability:
ICC > GCC >> Clang > MSVC

Standard compliance:
GCC > Clang > ICC >> MSVC

So, as you see, the issue isn't trivial. For example, faster compilation usually means fewer performance optimizations (e.g., MSVC). Narrower platform support can often mean better debugging tools or platform-specific optimizations. And so on. And then, value-for-money is not trivial either, the Intel compilers beat most other compilers on most fronts and by a large margin, but it is also much more expensive. While GCC and Clang are free and open-source, so they technically have infinite value-for-money. And then, there are many things that I didn't mention, like most of the marketing points of Clang, which are its more helpful error/warning messages, its open-source native C++ implementation making it nicer for writing your own derivative tools, and so on.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.