You should always prefer to use more general tests than less general ones, since that way your program is more likely to work on future hardware and other operating systems. Most of these defines are specific to GCC. Check for them with #if defined(macro).
| Compiler | |
__GNUC__ | You're compiling with GCC |
__APPLE_CC__ | You're compiling with Apple's own GCC |
| Operating System | |
__APPLE__ | You're compiling for Apple hardware |
linux | You're compiling for Linux |
_WIN32 | You're compiling for 32-bit Windows |
| Hardware (General) | |
__LP64__ | (Apple-only) You're compiling for a 64-bit machine (Longs and Pointers are 64-bit) |
__BIG_ENDIAN__ | You're compiling for a big-endian machine |
__LITTLE_ENDIAN__ | You're compiling for a little-endian machine |
| Hardware (Specific) | |
__ppc__ | You're compiling for a 32-bit PowerPC |
__i386__ | You're compiling for a 32-bit Intel |
__ppc64__ | You're compiling for a 64-bit PowerPC |
__x86_64__ | You're compiling for a 64-bit Intel |