While reading various C and C++ sources, I have encountered two macros __APPLE__
and __OSX__
. I found plenty of use of __OSX__
in vari
Use
#if defined(__APPLE__) && defined(__MACH__)
to distinguish Apple MacOS (not iOS).
Regarding the "where does OSX come from":
Some on-line lists of compiler macros (like this one) list
__MACOSX__
. Some forum comments (like these) claim__OSX__
exists. These are incorrect. There are no such macros predefined by OSX compilers, but they may be defined by specific project Makefiles and platform-detector scripts like GNU autoconf.
Source: http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system