c++c-preprocessor

What's the difference between the WIN32 and _WIN32 defines in C++


I know that WIN32 denotes win32 compilation but what is _WIN32 used for?


Solution

  • WIN32 is a name that you could use and even define in your own code and so might clash with Microsoft's usage. _WIN32 is a name that is reserved for the implementor (in this case Microsoft) because it begins with an underscore and an uppercase letter - you are not allowed to define reserved names in your own code, so there can be no clash.