Thanks to Brian Hook, who seems to have collected a great list compiler defines for various architectures and operating systems. Here is the actual link.
GNU GCC/G++:
- __GNUC__: GNU C version
- __GNUG__: GNU C++ compiler
- __sun__ : on Sun platforms
- __svr4__: on Solaris and other SysV R4 platforms
- __mips__: on MIPS processor platforms
- __sparc_v9__: on Sparc 64-bit CPUs
- __sparcv9: 64-bit Solaris
- __MIPSEL__: mips processor, compiled for little endian
- __MIPSEB__: mips processor, compiled for big endian
- _R5900: MIPS/Sony/Toshiba R5900 (PS2)
- mc68000: 68K
- m68000: 68K
- m68k: 68K
- __palmos__: PalmOS
Intel C/C++ Compiler:
- __ECC : compiler version, IA64 only
- __EDG__
- __ELF__
- __GXX_ABI_VERSION
- __i386 : IA-32 only
- __i386__ : IA-32 only
- i386 : IA-32 only
- __ia64 : IA-64 only
- __ia64__ : IA-64 only
- ia64 : IA-64 only
- __ICC : IA-32 only
- __INTEL_COMPILER : IA-32 or IA-64, newer versions only
Apple's C/C++ Compiler for OS X:
- __APPLE_CC__
- __APPLE__
- __BIG_ENDIAN__
- __APPLE__
- __ppc__
- __MACH__
DJGPP:
- __MSDOS__
- __unix__
- __unix
- __GNUC__
- __GO32
- DJGPP
- __i386, __i386, i386
Cray's C compiler:
- _ADDR64: if 64-bit pointers
- _UNICOS:
- __unix:
SGI's CC compiler predefines the following (and more) with -ansi:
- __sgi
- __unix
- __host_mips
- _SYSTYPE_SVR4
- __mips
- _MIPSEB
- anyone know if there is a predefined symbol for the compiler?!
MinGW:
- as GnuC but also defines _WIN32, __WIN32, WIN32, _X86_, __i386, __i386__, and several others
- __MINGW32__
Cygwin:
- as Gnu C, but also
- __unix__
- __CYGWIN32__
Microsoft Visual Studio predefines the following:
- _MSC_VER
- _WIN32: on Win32
- _M_IX6 (on x86 systems)
- _M_X64: on x86-64 systems
- _M_ALPHA (on DEC AXP systems)
- _SH3: WinCE, Hitachi SH-3
- _MIPS: WinCE, MIPS
- _ARM: WinCE, ARM
Sun's C Compiler:
- sun and _sun
- unix and _unix
- sparc and _sparc (SPARC systems only)
- i386 and _i386 (x86 systems only)
- __SVR4 (Solaris only)
- __sparcv9: 64-bit solaris
- __SUNPRO_C
- _LP64: defined in 64-bit LP64 mode, but only if
Borland C/C++ predefines the following:
- __BORLANDC__:
DEC/Compaq C/C++ on Alpha:
- __alpha
- __arch64__
- __unix__ (on Tru64 Unix)
- __osf__
- __DECC
- __DECCXX (C++ compilation)
- __DECC_VER
- __DECCXX_VER
IBM's AIX compiler:
- __64BIT__ if 64-bit mode
- _AIX
- __IBMC__: C compiler version
- __IBMCPP__: C++ compiler version
- _LONG_LONG: compiler allows long long
Watcom:
- __WATCOMC__
- __DOS__ : if targeting DOS
- __386__ : if 32-bit support
- __WIN32__ : if targetin 32-bit Windows
HP-UX C/C++ Compiler:
- __hpux
- __unix
- __hppa (on PA-RISC)
- __LP64__: if compiled in 64-bit mode
Metrowerks:
- __MWERKS__
- __powerpc__
- _powerc
- __MC68K__
- macintosh when compiling for MacOS
- __INTEL__ for x86 targets
- __POWERPC__
No comments:
Post a Comment