Some months ago I posted the following question Problem with templates in VS 6.0
The ensuing discussion and your comments helped me to realize that getting my hands on a new compiler was mandatory - or basically they were the final spark which set me into motion. After one month of company-internal "lobbying" I am finally getting VS 2012 !! (thank you guys)
Several old tools which I have to use were developed with VS 6.0
My concerns are that some of these tools might not work with the new Compiler. This is why I was wondering whether somebody here could point out the major differences between VS 6 and VS 2012 - or at least the ones between VS 6 and VS 2010 - the changes from 2010 to 2012 are well documentes online.
Obviously the differences between VS 6.0 and VS 12 must be enormous ... I am mostly concerned with basic things like casts etc. There is hardly any information about VS 6.0 on the web - and I am somewhat at a loss :(
I think I will have to create new projects with the same classes. In the second step I would overwrite the .h and .cpp files with the ones of the old tools. Thus at least I will be able to open the files via the new compiler. Still some casts or Class definitions might not be supported and I would like to have a general idea of what to look for while debugging :)
The language has evolved significantly since VS 6.0 came out. VS6.0 is pre-C++98; VS 2012 is C++03, with a few features from C++11.
Most of the newer language features are upwards compatible; older code should still work. Still, VC 6.0 is pre-standard, and the committee was less concerned about breaking existing code when there was no previous standard (and implementations did vary). There are several aspects of the language (at least) which might cause problems.
The first is that VC 6.0 still used the old scoping for
variables defined in a for
. Thus, in VC 6.0, things like the following
were legal:
int findIndex( int* array, int size, int target )
{
for ( int i = 0; i < size && array[i] != target ; ++ i ) {
}
return i;
}
This will not compile in VC 2012 (unless there is also a global
variable i
, in which case, it will return that, and not the
local one).
IIRC, too, VC 6.0 wasn't very strict in enforcing access controls and const. This may not be problem when migrating, however, because VC 2012 still fails to conform to C++98 in some of the more flagrant cases, at least with the default options. (You can still bind a temporary to a non-const reference, for example.)
Another major language change which isn't backwards compatible is name lookup in templates. Here too, however, even in VC 2012, Microsoft has implemented pre-standanrd name lookup (and I mean pre-C++98). This is a serious problem if you want to port your code to other compilers, but it does make migrating from VC 6.0 to VC 2012 a lot easier.
With regards to the library, I can't remember whether 6.0
supported the C++98 library, or whether it was still
pre-standard (or possibly it supported both). If your code has
things like #include <iostream.h>
in it, be prepared for some
differences here: minor for straight forward use of <<
and
>>
; major if you implement some complicated streambuf
. And
of course, all of the library was moved from global namespace to
std::
.
For the rest: your code obviously won't use any of the features introduced after VC 6.0 appeared. This won't cause migration problems (since the older features are still supported), but you'll doubtlessly want to go back, and gradually upgrade the code once you've migrated. (You mentionned casts. This is a good example: C style casts are still legal, with the same semantics they've always had, but in new code, you'll want to avoid them, and least when pointers or references are involved.)