i have started using C++ these days. Initially , I have done coding alot in C language. I have seen that on my onliune judges , there are 2 different versions. Why they have given 2 versions to compile the code ? Can you tell ? thanks if you can help me..

i dont know what these versions are... i do coding on online judges like spoj etc... they have this division... so i was asking why are they giving this division.. there is no division in python, java, C , or any other,,, but why in this one only

Well, I looked at spoj, and they do have different versions available for most of the other languages too. For C++, they explicitly say (g++ 4.3.2) and (g++ 4.0.0-8) which are the GCC C++ compiler versions 4.3.2 and 4.0.0. These are both fairly ancient compilers. If you look at GCC version history, you'll see that 4.3.2 dates back to August 2008, and version 4.0.0 dates back to April 2005. I don't know why they would single out these two particular versions, but my guess is this. The 2005 version states, in the change logs, that only experimental support for TR1 is provided, which hints at the fact that this compiler is probably fully compliant to the C++98 standard but didn't yet include much of the ammendments / additions of C++03 standard (from 2003). The 2008 version probably has complete support for C++03 and TR1 libraries.

Now, why would there be a choice? Wouldn't everyone just want to use the latest version they provide? Well, if you want to make sure that your code is compilable even on an old compiler that supports on C++98 features, then you might want to use that older compiler. Very often, installing an ancient compiler on your own computer can be a real hassle, so an online utility might be a good little tool for checking small things.

You have to understand that programming languages are constantly evolving. Languages like C and C++ are extremely highly used throughout the world, and thus, they are governed by lengthy and carefully crafted standards, which is renewed every 5-10 years or so. So, compilers also change and vary between them. If you ever try to maintain a library to be compilable across different compilers, compiler versions, library versions, and operating systems, you'll understand what this is all about.

This article has been dead for over six months. Start a new discussion instead.