프로그래밍/OS-specified
Pre-defined Operating System Macros
반응형
Pre-defined Operating System Macros
Home | Standards | Compilers | Libraries | Operating Systems | Architectures |
Table of Content - Operating Systems
- Table of Content - Operating Systems
- AIX
- AmigaOS
- Android
- BeOS
- BSD/OS
- Cray UniCOS
- DG/UX
- DragonFly
- DYNIX/ptx
- eCos
- FreeBSD
- GNU Hurd
- HI-UX/MPP
- HP-UX
- INTEGRITY
- IRIX
- Linux
- LynxOS
- MacOS
- Microware OS-9
- MINIX
- MPE/iX
- MSDOS
- MS Windows
- MS Windows CE
- NetBSD
- NonStop
- Nucleus OS
- OpenBSD
- OS/2
- Pyramid DC/OS
- QNX
- Reliant UNIX
- SCO OpenServer
- Solaris
- Symbian OS
- Tru64 (OSF/1)
- Ultrix
- UnixWare
- VMS
- XBox
- z/OS (OS/390)
- BSD Environment
- EMX Environment
- SVR4 Environment
- Unix Environment
- U/Win Environment
- Wind/U Environment
AIX
Type | Macro | Description |
---|---|---|
Identification | _AIX | . |
Version | . | See example |
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 | Macro |
---|---|
3.2.x | _AIX3, _AIX32 |
4.1 | _AIX41 |
4.3 | _AIX43 |
Official site | Google Directory | Wikipedia |
AmigaOS
Type | Macro | Description |
---|---|---|
Identification | AMIGA | . |
Identification | __amigaos__ | Defined by GNU C |
Official site | Google Directory | Wikipedia |
Android
Type | Macro | Description |
---|---|---|
Identification | __ANDROID__ | Defined by GNU C |
Official site | Google Directory | Wikipedia |
BeOS
Type | Macro |
---|---|
Identification | __BEOS__ |
Official site | Google Directory | Wikipedia |
BSD/OS
Type | Macro |
---|---|
Identification | __bsdi__ |
Cray UniCOS
Type | Macro | Format | Description |
---|---|---|---|
Identification | _UNICOS | . | . |
Version | _UNICOS | V | V = Version |
Official site | Wikipedia |
DG/UX
Type | Macro |
---|---|
Identification | DGUX |
Identification | __DGUX__ |
Identification | __dgux__ |
Official site | Wikipedia |
DragonFly
Type | Macro |
---|---|
Identification | __DragonFly__ |
Official site | Wikipedia |
DYNIX/ptx
Type | Macro |
---|---|
Identification | _SEQUENT_ |
Identification | sequent |
Official site | Wikipedia |
eCos
Type | Macro |
---|---|
Identification | __ECOS |
Official site | Google Directory | Wikipedia |
FreeBSD
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.
Official site | Google Directory | Wikipedia |
GNU Hurd
Type | Macro |
---|---|
Identification | __GNU__ |
Official site | Google Directory | Wikipedia |
HI-UX/MPP
Type | Macro |
---|---|
Identification | __hiuxmpp |
HP-UX
Type | Macro | Description |
---|---|---|
Identification | _hpux | Defined by HP UPC |
Identification | hpux | . |
Identification | __hpux | . |
Official site | Google Directory | Wikipedia |
INTEGRITY
Type | Macro |
---|---|
Identification | __INTEGRITY |
Official site | Google Directory | Wikipedia |
IRIX
Type | Macro |
---|---|
Identification | sgi |
Identification | __sgi |
Official site | Google Directory | Wikipedia |
Linux
Type | Macro |
---|---|
Identification | linux |
Identification | __linux |
Official site | Google Directory | Wikipedia |
LynxOS
Type | Macro |
---|---|
Identification | __Lynx__ |
Official site | Google Directory | Wikipedia |
MacOS
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++ |
Official site | Google Directory | Wikipedia |
Microware OS-9
Type | Macro | Description |
---|---|---|
Identification | __OS9000 | Defined by Ultimate C/C++ |
Identification | _OSK | Defined by Ultimate C/C++ |
Official site | Wikipedia |
MINIX
Type | Macro |
---|---|
Identification | __minix |
Official site | Google Directory | Wikipedia |
MPE/iX
Type | Macro |
---|---|
Identification | mpeix |
Identification | __mpexl |
Official site | Wikipedia |
MSDOS
Type | Macro |
---|---|
Identification | MSDOS |
Identification | __MSDOS__ |
Identification | _MSDOS |
Identification | __DOS__ |
Google Directory | Wikipedia |
MS Windows
Type | Macro | Description |
---|---|---|
Identification | _WIN32 | Defined for both 32-bit and 64-bit environments |
Identification | _WIN64 | Defined for 64-bit environments. |
Identification | __WIN32__ | Defined by Borland C++ |
Identification | __TOS_WIN__ | Defined by xlC |
Identification | __WINDOWS__ | Defined by Watcom C/C++ |
Official site | Google Directory | Wikipedia |
MS Windows CE
Type | Macro | Format | Description |
---|---|---|---|
Identification | _WIN32_WCE | . | Defined by Embedded Visual Studio C++ |
Version | _WIN32_WCE | VRR | V = Version R = Revision |
Identification | WIN32_PLATFORM_'P' | . | P = Platform |
Version | WIN32_PLATFORM_'P' | V | P = Platform V = Version |
Example
Version | _WIN32_WCE |
---|---|
2.01 | 201 |
2.11 | 211 |
3.0 | 300 |
4.0 | 400 |
4.1 | 410 |
4.2 | 420 |
5.0 | 501 |
Platform | Macro | Value |
---|---|---|
H/PC 2000 | WIN32_PLATFORM_HPC2000 | . |
H/PC Pro 2.11 | WIN32_PLATFORM_HPCPRO | 211 |
H/PC Pro 3.0 | WIN32_PLATFORM_HPCPRO | 300 |
Pocket PC | WIN32_PLATFORM_PSPC | 1 |
Pocket PC 2002 | WIN32_PLATFORM_PSPC | 310 |
Windows Mobile 2003 | WIN32_PLATFORM_PSPC | 400 |
Smartphone 2002 | WIN32_PLATFORM_WFSP | 100 |
Official site | Google Directory | Wikipedia |
NetBSD
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 | . |
Official site | Google Directory | Wikipedia |
NonStop
Type | Macro |
---|---|
Identification | __TANDEM |
Official site | Wikipedia |
Nucleus OS
Type | Macro |
---|---|
Identification | __nucleus__ |
Bada is based on Nucleus OS.
Official site | Wikipedia |
OpenBSD
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 |
Official site | Google Directory | Wikipedia |
OS/2
Type | Macro |
---|---|
Identification | OS2 |
Identification | _OS2 |
Identification | __OS2__ |
Identification | __TOS_OS2__ |
Official site | Google Directory | Wikipedia |
Pyramid DC/OS
Type | Macro |
---|---|
Identification | pyr |
QNX
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
QNX | _NTO_VERSION |
---|---|
6.2 | 620 |
Official site | Google Directory | Wikipedia |
Reliant UNIX
Type | Macro |
---|---|
Identification | sinux |
SCO OpenServer
Type | Macro | Description |
---|---|---|
Identification | M_I386 | Defined by GNU C |
Identification | M_XENIX | Defined by GNU C |
Identification | _SCO_DS | . |
Official site | Google Directory | Wikipedia |
Solaris
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 |
Official site | Google Directory | Wikipedia |
Symbian OS
Type | Macro |
---|---|
Identification | __SYMBIAN32__ |
Official site | Wikipedia |
Tru64 (OSF/1)
Type | Macro |
---|---|
Identification | __osf__ |
Identification | __osf |
Official site | Google Directory | Wikipedia |
Ultrix
Type | Macro |
---|---|
Identification | ultrix |
Identification | __ultrix |
Identification | __ultrix__ |
Identification | unix & vax |
UnixWare
Type | Macro |
---|---|
Identification | sco |
Identification | _UNIXWARE7 |
Official site | Google Directory | Wikipedia |
VMS
Type | Macro | Format | Description |
---|---|---|---|
Identification | VMS | . | . |
Identification | __VMS | . | . |
Version | __VMS_VER | VVRREPPTT | VV = Version RR = Revision E = Edit number PP = Patch (01 = A, ... 26 = Z) TT = Type (22 = official) |
Example
VMS | __VMS_VER |
---|---|
6.1 | 60100022 |
6.2 | 60200022 |
6.2-1I | 60210922 |
Official site | Google Directory | Wikipedia |
XBox
Type | Macro | Format | Description |
Identification | _XBOX | . | . |
Version | _XBOX_VER | VRR | V = Version RR = Revision |
Example
Console | _XBOX_VER |
---|---|
Xbox 360 | 200 |
Official site | Wikipedia |
z/OS (OS/390)
Type | Macro | Description |
---|---|---|
Identification | __MVS__ | Host |
Identification | __HOS_MVS__ | Host |
Identification | __TOS_MVS__ | Target |
Official site | Google Directory | Wikipedia |
BSD Environment
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 | . |
EMX Environment
Unix compatible environment for OS/2.
Type | Macro |
---|---|
Identification | __EMX__ |
Unofficial site | Google Directory |
SVR4 Environment
Type | Macro | Description |
---|---|---|
Identification | __sysv__ | . |
Identification | __SVR4 | . |
Identification | __svr4__ | . |
Identification | _SYSTYPE_SVR4 | Defined on IRIX |
Official site | Wikipedia |
Unix Environment
Type | Macro |
---|---|
Identification | __unix__ |
Identification | __unix |
Please note that not all compilers defines these macros, e.g. the xlC or the DEC C/C++ compiler, so it may be better to use the POSIX or X/Open standard macros instead.
Google Directory | Wikipedia |
U/Win Environment
Type | Macro |
---|---|
Identification | _UWIN |
Wind/U Environment
Type | Macro |
---|---|
Identification | _WINDU_SOURCE |
Example
Wind/U | _WINDU_SOURCE |
---|---|
3.1.2 | 0x030102 |
반응형
댓글