Wednesday, December 9, 2009

Visual C++ 6 to Visual Studio 2008

Porting the last vestige of VC++ 6 to Visual Studio 2008.  Over the years the Microsoft C++ compiler has gotten more standards compliant.  Oddities like:
for (int i=0; i < SOMEVAL; i++)
{
// ...
}

if ( i > SOMEOTHERVAL )





no longer pass muster; ISO C thankfully limits the scope of i to the block in which it is defined.  I say thankfully because it’s so common to use i as a loop variable that promoting its scope to the enclosing scope (the default behavior of older compilers) is asking for loops to step on each other’s loop counter.

Other things to keep an eye out for:

  • Turning off wchar_t as an implicit type if the existing 2008 solution/project has it disabled.
  • Mixing MBCS and Unicode.
  • Hardcoded paths to old versions of SDK header files (e.g., program files\visual studio\vc98\include\…)
  • Use of swprintf() without specifying a count for the maximum number of characters to write.

No comments :

Post a Comment