www.digitalmars.com         C & C++   DMDScript  

c++.command-line - _MSC_VER

I've been struggling with C++ source primarily intended for MS VCPP 7 and
other versions, and notice that some sections are conditionally compiled
based upon the number that  _MSC_VER has been set to.
Some DMC programmers seem to go around and on a case by case basis and
adding an
|| defined(__DMC__) to the #if.

Is there a MSC version number that would be pretty much catch most things
rather than currently defaulting to having the source flow path act as if
DMC can't handle anything that MSC can?

e.g.
#if !defined(WINAPI)
    #if defined(_WIN32) && (_MSC_VER >= 800)
        #define WINAPI              __stdcall
    #elif defined(WIN16)
        #define WINAPI              _far _pascal
    #else
        #define WINAPI              _far _pascal
    #endif
#endif

I presume DMC happily handles __stdcall so if WINAPI is not *yet* defined
but _WIN32 is, if I read that cluster of defines correctly, it will result
in the last define being processed and the macro WINAPI equates to
_far_pascal which I believe would be wrong for DMC... I understand that one
can add in each and every similar situation an additional clause could be
added || defined(__DMC__) but that could amount to hundreds of edits or more
when maybe simply pre-defining _MSC_VER 1000 or some other number would
reduce the initial screen loads of warnings and errors? Leaving just those
truly MS only CPP quirks that have to be coded around conditionally?

It is just seeming like too much battling compiler conditionals that have no
relevance to porting between different compilers but to backwards
compatibility...

I am not an accomplished CPP programmer and have a couple of projects I need
to attempt but so far
I've yet to find a relevant tutorial or library and compiler that will work
enough for me to take the initial steps needed to find out how to do the
things I need to do with COM classes and the general win32api.

I have installed on another machine that runs XP SP2 the MSVCPP 2005 express
commandline compiler and the current PlatfomSDK from the ISO distro'
download and even that would not compile all the included samples with the
MS VCPP compiler when I followed the instructions word for word!

There seems to be no download, install and start learning to program...
instead its download, install and start learning to workaround compiler
dialects and other incompatibilities.
TIA
Mar 12 2006