   Predefined Macros and OS's
  I've been looking at different macros that compilers use when defining the current operating system e.g. _WIN32 and _WIN64.  What I've also noticed though is that different compilers seem to define some macros differently (like Borland defining it as __WIN32__, even though some other compilers define it like that too).Is there any standard definition for an operating system?  Like _WIN32 for windows, __MACOSX__ for Macs (OS X), ect. Or do I just have to pick a couple of the popular compilers and stick with what they decide?Another question, I've always used #ifdef MACRO_HERE for checking if something is defined.  But I've seen others doing #if defined (MACRO_HERE) .  Is there any which is right or wrong?  It's all so confusing!Thanks   
  You have to check them all if you want to be sureexampleQuote:Another question, I've always used #ifdef MACRO_HERE for checking if something is defined. But I've seen others doing #if defined (MACRO_HERE) . Is there any which is right or wrong? It's all so confusing!I dont think there is any difference between those, except that the defined directive can be used with the AND and OR operators:#if defined FOO || defined BAR // Fine#ifdef FOO || ifdef BAR  // <-- Gives a warning;Quote:Original post by pulpfistI dont think there is any difference between those, except that the defined directive can be used with the AND and OR operators:#if defined FOO || defined BAR // Fine#ifdef FOO || ifdef BAR  // <-- Gives a warningBrackets required.#if defined(FOO) || defined(BAR)#elif defined(CHICKEN)#endif;Quote:You have to check them all if you want to be sureThis site is helpful: http://predef.sourceforge.net/It lists predefined macros that are standard, provided by various compilers or APIs, et cetera.   ;  Thank you all very much!!   