| Type |
Macro |
Description |
| Identification |
_AIX |
|
| Version |
_AIX'VR' |
V = Version R = Revision |
| Identification |
__TOS_AIX__ |
Defined by xlC |
Example
If _AIX is defined, then the following macros can be used to determine the version. Please note that the macros indicates the mentioned version or higher. For example, if _AIX43 is defined, then _AIX41 will also be defined.
| AIX Version |
Macro |
| 3.2.x |
_AIX3
_AIX32 |
| 4.1 |
_AIX41 |
| 4.3 |
_AIX43 |
| Type |
Macro |
Format |
Description |
| Identification |
__ANDROID__ |
|
|
| Version |
__ANDROID_API__ |
V |
V = API Version
Must be included from <android/api-level.h> |
Please notice that Android is based on Linux, and that the Linux macros also are defined for Android.
Example
| Android Version |
__ANDROID_API__ |
| 1.0 |
1 |
| 1.1 |
2 |
| 1.5 |
3 |
| 1.6 |
4 |
| 2.0 |
5 |
| 2.0.1 |
6 |
| 2.1 |
7 |
| 2.2 |
8 |
| 2.3 |
9 |
| 2.3.3 |
10 |
| 3.0 |
11 |
| Type |
Macro |
| Identification |
UTS |
| Type |
Macro |
Description |
| Identification |
AMIGA |
|
| Identification |
__amigaos__ |
Defined by GNU C |
| Type |
Macro |
| Identification |
aegis |
| Type |
Macro |
| Identification |
apollo |
Based on Nucleus OS.
| Type |
Macro |
| Identification |
__BEOS__ |
| Type |
Macro |
Format |
Description |
| Identification |
__FreeBSD__
__NetBSD__
__OpenBSD__
__bsdi__
__DragonFly__ |
|
|
| Version |
BSD |
YYYYMM |
YYYY = Year MM = Month
Must be included from <sys/param.h> |
| Version |
BSD4_2
BSD4_3
BSD4_4 |
|
Must be included from <sys/param.h> |
| Identification |
_SYSTYPE_BSD |
|
Defined by DEC C |
Example
| Version |
BSD |
Macro |
| 4.3 Net2 |
199103 |
|
| 4.4 |
199306 |
BSD4_4 |
| 4.4BSD-Lite2 |
199506 |
|
| Type |
Macro |
| Identification |
__bsdi__ |
| Type |
Macro |
| Identification |
__convex__ |
| Type |
Macro |
| Identification |
__CYGWIN__ |
| Type |
Macro |
| Identification |
DGUX |
| Identification |
__DGUX__ |
| Identification |
__dgux__ |
| Type |
Macro |
| Identification |
__DragonFly__ |
| Type |
Macro |
| Identification |
_SEQUENT_ |
| Identification |
sequent |
| Type |
Macro |
| Identification |
__ECOS |
| Type |
Macro |
| Identification |
__EMX__ |
| Type |
Macro |
Format |
Description |
| Identification |
__FreeBSD__ |
|
|
| Version |
BSD |
|
|
| Version |
__FreeBSD__ |
V |
V = Version |
| Version |
__FreeBSD_version |
? |
Must be included from <osreldate.h> |
Example
| FreeBSD |
__FreeBSD__ |
__FreeBSD_version |
| 1.x |
1 |
|
| 2.0-RELEASE |
2 |
119411 |
| 2.2-RELEASE |
2 |
220000 |
| 3.0-RELEASE |
3 |
300005 |
| 4.0-RELEASE |
4 |
400017 |
| 4.5-RELEASE |
4 |
450000 |
For more information see the FreeBSD porters handbook.
| Type |
Macro |
| Identification |
__GNU__ |
| Type |
Macro |
| Identification |
__hiuxmpp |
| Type |
Macro |
Description |
| Identification |
_hpux |
Defined by HP UPC |
| Identification |
hpux |
|
| Identification |
__hpux |
|
| Type |
Macro |
| Identification |
__OS400__ |
| Type |
Macro |
| Identification |
__INTEGRITY |
| Type |
Macro |
Description |
| Identification |
__INTERIX |
Defined by GNU C and Visual Studio |
| Type |
Macro |
| Identification |
sgi |
| Identification |
__sgi |
| Type |
Macro |
Description |
| Identification |
__linux__ |
|
| Identification |
linux |
Obsolete |
| Identification |
__linux |
Obsolete |
| Type |
Macro |
| Identification |
__Lynx__ |
| Type |
Macro |
Description |
| Identification |
macintosh |
Mac OS 9 |
| Identification |
Macintosh |
Mac OS 9 |
| Identification |
__APPLE__ & __MACH__ |
Mac OS X
Defined by GNU C and Intel C++ |
| Type |
Macro |
Description |
| Identification |
__OS9000 |
Defined by Ultimate C/C++ |
| Identification |
_OSK |
Defined by Ultimate C/C++ |
| Type |
Macro |
| Identification |
__minix |
| Type |
Macro |
| Identification |
__MORPHOS__ |
| Type |
Macro |
| Identification |
mpeix |
| Identification |
__mpexl |
| Type |
Macro |
| Identification |
MSDOS |
| Identification |
__MSDOS__ |
| Identification |
_MSDOS |
| Identification |
__DOS__ |
| Type |
Macro |
Format |
Description |
| Identification |
__NetBSD__ |
|
|
| Version |
BSD |
|
|
| Version |
NetBSD'V'_'R' |
|
V = Version R = Revision
Must be included from <sys/param.h> |
| Version |
__NetBSD_Version__ |
VVRRAAPP00 |
VV = Version RR = Revision AA = Release PP = Patch
From NetBSD 1.2D (?) until NetBSD 2.0H
Must be included from <sys/param.h> |
| Version |
__NetBSD_Version__ |
VVRR00PP00 |
VV = Version RR = Revision PP = Patch
From NetBSD 2.99.9
Must be included from <sys/param.h> |
Example
| NetBSD |
__NetBSD_Version__ |
Macro |
| 0.8 |
|
NetBSD0_8 |
| 0.9 |
|
NetBSD0_9 |
| 1.0 |
|
NetBSD1_0 = 1 |
| 1.0A |
|
NetBSD1_0 = 2 |
| 1.2D |
102040000 |
|
| 1.2.1 |
102000100 |
|
| Type |
Macro |
| Identification |
__TANDEM |
| Type |
Macro |
| Identification |
__nucleus__ |
| Type |
Macro |
Format |
Description |
| Identification |
__OpenBSD__ |
|
|
| Version |
BSD |
|
|
| Version |
OpenBSD'V'_'R' |
|
V = Version R = Revision
Must be included from <sys/param.h> |
Example
| OpenBSD |
Macro |
| 3.1 |
OpenBSD3_1 |
| 3.9 |
OpenBSD3_9 |
| Type |
Macro |
| Identification |
OS2 |
| Identification |
_OS2 |
| Identification |
__OS2__ |
| Identification |
__TOS_OS2__ |
| Type |
Macro |
Description |
| Identification |
__palmos__ |
Defined by GNU C in PRC-Tools |
| Type |
Macro |
| Identification |
pyr |
| Type |
Macro |
Format |
Description |
| Identification |
__QNX__ |
|
QNX 4.x |
| Identification |
__QNXNTO__ |
|
QNX 6.x |
| Version |
_NTO_VERSION |
VRR |
V = Version RR = Revision
Only available when __QNXNTO__ is defined.
Must be included from <sys/neutrino.h> |
Example
| Type |
Macro |
| Identification |
sinux |
| Type |
Macro |
Description |
| Identification |
M_I386 |
Defined by GNU C |
| Identification |
M_XENIX |
Defined by GNU C |
| Identification |
_SCO_DS |
|
| Type |
Macro |
Description |
| Identification |
sun |
|
| Identification |
__sun |
|
| Version |
__'System'_'Version' |
System = uname -s Version = uname -r Any illegal character is replaced by an underscore.
Defined by Sun Studio |
Use the SVR4 macros to distinguish between Solaris and SunOS.
#if defined(sun) || defined(__sun)
# if defined(__SVR4) || defined(__svr4__)
/* Solaris */
# else
/* SunOS */
# endif
#endif
Example
| Solaris |
Macro |
| 2.7 |
__SunOS_5_7 |
| 8 |
__SunOS_5_8 |