Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Reference

BOOST_ARCH architecture macros
BOOST_COMP compiler macros
BOOST_LANG language standards macros
BOOST_LIB library macros
BOOST_OS operating system macros
BOOST_PLAT platform macros
BOOST_HW hardware macros
Other macros
Version definition macros
BOOST_ARCH_ALPHA

DEC Alpha architecture.

Symbol

Version

__alpha__

detection

__alpha

detection

_M_ALPHA

detection

__alpha_ev4__

4.0.0

__alpha_ev5__

5.0.0

__alpha_ev6__

6.0.0

BOOST_ARCH_ARM

ARM architecture.

Symbol

Version

__arm__

detection

__arm64

detection

__thumb__

detection

__TARGET_ARCH_ARM

detection

__TARGET_ARCH_THUMB

detection

_M_ARM

detection

__arm64

8.0.0

__TARGET_ARCH_ARM

V.0.0

__TARGET_ARCH_THUMB

V.0.0

_M_ARM

V.0.0

BOOST_ARCH_BLACKFIN

Blackfin Processors from Analog Devices.

Symbol

Version

__bfin__

detection

__BFIN__

detection

bfin

detection

BFIN

detection

BOOST_ARCH_CONVEX

Convex Computer architecture.

Symbol

Version

__convex__

detection

__convex_c1__

1.0.0

__convex_c2__

2.0.0

__convex_c32__

3.2.0

__convex_c34__

3.4.0

__convex_c38__

3.8.0

BOOST_ARCH_IA64

Intel Itanium 64 architecture.

Symbol

Version

__ia64__

detection

_IA64

detection

__IA64__

detection

__ia64

detection

_M_IA64

detection

__itanium__

detection

BOOST_ARCH_M68K

Motorola 68k architecture.

Symbol

Version

__m68k__

detection

M68000

detection

__mc68060__

6.0.0

mc68060

6.0.0

__mc68060

6.0.0

__mc68040__

4.0.0

mc68040

4.0.0

__mc68040

4.0.0

__mc68030__

3.0.0

mc68030

3.0.0

__mc68030

3.0.0

__mc68020__

2.0.0

mc68020

2.0.0

__mc68020

2.0.0

__mc68010__

1.0.0

mc68010

1.0.0

__mc68010

1.0.0

__mc68000__

0.0.1

mc68000

0.0.1

__mc68000

0.0.1

BOOST_ARCH_MIPS

MIPS architecture.

Symbol

Version

__mips__

detection

__mips

detection

__MIPS__

detection

__mips

V.0.0

_MIPS_ISA_MIPS1

1.0.0

_R3000

1.0.0

_MIPS_ISA_MIPS2

2.0.0

__MIPS_ISA2__

2.0.0

_R4000

2.0.0

_MIPS_ISA_MIPS3

3.0.0

__MIPS_ISA3__

3.0.0

_MIPS_ISA_MIPS4

4.0.0

__MIPS_ISA4__

4.0.0

BOOST_ARCH_PARISK

HP/PA RISC architecture.

Symbol

Version

__hppa__

detection

__hppa

detection

__HPPA__

detection

_PA_RISC1_0

1.0.0

_PA_RISC1_1

1.1.0

__HPPA11__

1.1.0

__PA7100__

1.1.0

_PA_RISC2_0

2.0.0

__RISC2_0__

2.0.0

__HPPA20__

2.0.0

__PA8000__

2.0.0

BOOST_ARCH_PPC

PowerPC architecture.

Symbol

Version

__powerpc

detection

__powerpc__

detection

__POWERPC__

detection

__ppc__

detection

_M_PPC

detection

_ARCH_PPC

detection

__PPCGECKO__

detection

__PPCBROADWAY__

detection

_XENON

detection

__ppc601__

6.1.0

_ARCH_601

6.1.0

__ppc603__

6.3.0

_ARCH_603

6.3.0

__ppc604__

6.4.0

__ppc604__

6.4.0

BOOST_ARCH_PYRAMID

Pyramid 9810 architecture.

Symbol

Version

pyr

detection

BOOST_ARCH_RS6000

RS/6000 architecture.

Symbol

Version

__THW_RS6000

detection

_IBMR2

detection

_POWER

detection

_ARCH_PWR

detection

_ARCH_PWR2

detection

BOOST_ARCH_SPARC

SPARC architecture.

Symbol

Version

__sparc__

detection

__sparc

detection

__sparcv9

9.0.0

__sparcv8

8.0.0

BOOST_ARCH_SH

SuperH architecture: If available versions [1-5] are specifically detected.

Symbol

Version

__sh__

detection

__SH5__

5.0.0

__SH4__

4.0.0

__sh3__

3.0.0

__SH3__

3.0.0

__sh2__

2.0.0

__sh1__

1.0.0

BOOST_ARCH_SYS370

System/370 architecture.

Symbol

Version

__370__

detection

__THW_370__

detection

BOOST_ARCH_SYS390

System/390 architecture.

Symbol

Version

__s390__

detection

__s390x__

detection

BOOST_ARCH_X86

Intel x86 architecture. This is a category to indicate that either BOOST_ARCH_X86_32 or BOOST_ARCH_X86_64 is detected.

BOOST_ARCH_Z

z/Architecture architecture.

Symbol

Version

__SYSC_ZARCH__

detection

BOOST_ARCH_X86_32

Intel x86 architecture: If available versions [3-6] are specifically detected.

Symbol

Version

i386

detection

__i386__

detection

__i486__

detection

__i586__

detection

__i686__

detection

__i386

detection

_M_IX86

detection

_X86_

detection

__THW_INTEL__

detection

__I86__

detection

__INTEL__

detection

__I86__

V.0.0

_M_IX86

V.0.0

__i686__

6.0.0

__i586__

5.0.0

__i486__

4.0.0

__i386__

3.0.0

BOOST_ARCH_X86_64

Intel IA-64 architecture.

Symbol

Version

__x86_64

detection

__x86_64__

detection

__amd64__

detection

__amd64

detection

_M_X64

detection

BOOST_COMP_BORLAND

Borland C++ compiler. Version number available as major, minor, and patch.

Symbol

Version

__BORLANDC__

detection

__CODEGEARC__

detection

__BORLANDC__

V.R.P

__CODEGEARC__

V.R.P

BOOST_COMP_CLANG

Clang compiler. Version number available as major, minor, and patch.

Symbol

Version

__clang__

detection

__clang_major__, __clang_minor__, __clang_patchlevel__

V.R.P

BOOST_COMP_COMO

Comeau C++ compiler. Version number available as major, minor, and patch.

Symbol

Version

__COMO__

detection

__COMO_VERSION__

V.R.P

BOOST_COMP_DEC

Compaq C/C++ compiler. Version number available as major, minor, and patch.

Symbol

Version

__DECCXX

detection

__DECC

detection

__DECCXX_VER

V.R.P

__DECC_VER

V.R.P

BOOST_COMP_DIAB

Diab C/C++ compiler. Version number available as major, minor, and patch.

Symbol

Version

__DCC__

detection

__VERSION_NUMBER__

V.R.P

BOOST_COMP_DMC

Digital Mars compiler. Version number available as major, minor, and patch.

Symbol

Version

__DMC__

detection

__DMC__

V.R.P

BOOST_COMP_SYSC

Dignus Systems/C++ compiler. Version number available as major, minor, and patch.

Symbol

Version

__SYSC__

detection

__SYSC_VER__

V.R.P

BOOST_COMP_EDG

EDG C++ Frontend compiler. Version number available as major, minor, and patch.

Symbol

Version

__EDG__

detection

__EDG_VERSION__

V.R.0

BOOST_COMP_PATH

EKOpath compiler. Version number available as major, minor, and patch.

Symbol

Version

__PATHCC__

detection

__PATHCC__, __PATHCC_MINOR__, __PATHCC_PATCHLEVEL__

V.R.P

BOOST_COMP_GNUC

Gnu GCC C/C++ compiler. Version number available as major, minor, and patch (if available).

Symbol

Version

__GNUC__

detection

__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__

V.R.P

__GNUC__, __GNUC_MINOR__

V.R.0

BOOST_COMP_GCCXML

GCC XML compiler.

Symbol

Version

__GCCXML__

detection

BOOST_COMP_GHS

Green Hills C/C++ compiler. Version number available as major, minor, and patch.

Symbol

Version

__ghs

detection

__ghs__

detection

__GHS_VERSION_NUMBER__

V.R.P

__ghs

V.R.P

BOOST_COMP_HPACC

HP aC++ compiler. Version number available as major, minor, and patch.

Symbol

Version

__HP_aCC

detection

__HP_aCC

V.R.P

BOOST_COMP_IAR

IAR C/C++ compiler. Version number available as major, minor, and patch.

Symbol

Version

__IAR_SYSTEMS_ICC__

detection

__VER__

V.R.P

BOOST_COMP_IBM

IBM XL C/C++ compiler. Version number available as major, minor, and patch.

Symbol

Version

__IBMCPP__

detection

__xlC__

detection

__xlc__

detection

__COMPILER_VER__

V.R.P

__xlC__

V.R.P

__xlc__

V.R.P

__IBMCPP__

V.R.P

BOOST_COMP_INTEL

Intel C/C++ compiler. Version number available as major, minor, and patch.

Symbol

Version

__INTEL_COMPILER

detection

__ICL

detection

__ICC

detection

__ECC

detection

__INTEL_COMPILER

V.R

__INTEL_COMPILER and __INTEL_COMPILER_UPDATE

V.R.P

BOOST_COMP_KCC

Kai C++ compiler. Version number available as major, minor, and patch.

Symbol

Version

__KCC

detection

__KCC_VERSION

V.R.P

BOOST_COMP_LLVM

LLVM compiler.

Symbol

Version

__llvm__

detection

BOOST_COMP_HIGHC

MetaWare High C/C++ compiler.

Symbol

Version

__HIGHC__

detection

BOOST_COMP_MWERKS

Metrowerks CodeWarrior compiler. Version number available as major, minor, and patch.

Symbol

Version

__MWERKS__

detection

__CWCC__

detection

__CWCC__

V.R.P

__MWERKS__

V.R.P >= 4.2.0

__MWERKS__

9.R.0

__MWERKS__

8.R.0

BOOST_COMP_MRI

Microtec C/C++ compiler.

Symbol

Version

_MRI

detection

BOOST_COMP_MPW

MPW C++ compiler. Version number available as major, and minor.

Symbol

Version

__MRC__

detection

MPW_C

detection

MPW_CPLUS

detection

__MRC__

V.R.0

BOOST_COMP_PALM

Palm C/C++ compiler. Version number available as major, minor, and patch.

Symbol

Version

_PACC_VER

detection

_PACC_VER

V.R.P

BOOST_COMP_PGI

Portland Group C/C++ compiler.

Symbol

Version

__PGI

detection

__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__

V.R.P

BOOST_COMP_SGI

SGI MIPSpro compiler. Version number available as major, minor, and patch.

Symbol

Version

__sgi

detection

sgi

detection

_SGI_COMPILER_VERSION

V.R.P

_COMPILER_VERSION

V.R.P

BOOST_COMP_SUNPRO

Oracle Solaris Studio compiler. Version number available as major, minor, and patch.

Symbol

Version

__SUNPRO_CC

detection

__SUNPRO_C

detection

__SUNPRO_CC

V.R.P

__SUNPRO_C

V.R.P

__SUNPRO_CC

VV.RR.P

__SUNPRO_C

VV.RR.P

BOOST_COMP_TENDRA

TenDRA C/C++ compiler.

Symbol

Version

__TenDRA__

detection

BOOST_COMP_MSVC

Microsoft Visual C/C++ compiler. Version number available as major, minor, and patch.

Symbol

Version

_MSC_VER

detection

_MSC_FULL_VER

V.R.P

_MSC_VER

V.R.0

[Note] Note

Release of Visual Studio after 2015 will no longer be identified by Boost Predef as the marketing version number. Instead we use the compiler version number directly, i.e. the _MSC_VER number.

BOOST_COMP_WATCOM

Watcom C++ compiler. Version number available as major, and minor.

Symbol

Version

__WATCOMC__

detection

__WATCOMC__

V.R.P

BOOST_LANG_OBJC

Objective-C language.

Symbol

Version

__OBJC__

detection

BOOST_LANG_STDC

Standard C language. If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date.

Symbol

Version

__STDC__

detection

__STDC_VERSION__

V.R.P

BOOST_LANG_STDCPP

Standard C++ language. If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date. Because of the way the C++ standardization process works the defined version year will not be the commonly known year of the standard. Specifically the defined versions are:

Table 28.1. Detected Version Number vs. C++ Standard Year

Detected Version Number

Standard Year

C++ Standard

27.11.1

1998

ISO/IEC 14882:1998

41.12.1

2011

ISO/IEC 14882:2011


Symbol

Version

__cplusplus

detection

__cplusplus

YYYY.MM.1

BOOST_LANG_STDCPPCLI

Standard C++/CLI language. If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date.

Symbol

Version

__cplusplus_cli

detection

__cplusplus_cli

YYYY.MM.1

BOOST_LANG_STDECPP

Standard Embedded C++ language.

Symbol

Version

__embedded_cplusplus

detection

BOOST_LIB_C_GNU

GNU glibc Standard C library. Version number available as major, and minor.

Symbol

Version

__GLIBC__

detection

__GNU_LIBRARY__

detection

__GLIBC__, __GLIBC_MINOR__

V.R.0

__GNU_LIBRARY__, __GNU_LIBRARY_MINOR__

V.R.0

BOOST_LIB_C_UC

uClibc Standard C library.

Symbol

Version

__UCLIBC__

detection

__UCLIBC_MAJOR__, __UCLIBC_MINOR__, __UCLIBC_SUBLEVEL__

V.R.P

BOOST_LIB_C_VMS

VMS libc Standard C library. Version number available as major, minor, and patch.

Symbol

Version

__CRTL_VER

detection

__CRTL_VER

V.R.P

BOOST_LIB_C_ZOS

z/OS libc Standard C library. Version number available as major, minor, and patch.

Symbol

Version

__LIBREL__

detection

__LIBREL__

V.R.P

__TARGET_LIB__

V.R.P

BOOST_LIB_STD_CXX

libc++ C++ Standard Library.

Symbol

Version

_LIBCPP_VERSION

detection

_LIBCPP_VERSION

V.0.P

BOOST_LIB_STD_DINKUMWARE

Dinkumware Standard C++ Library. If available version number as major, minor, and patch.

Symbol

Version

_YVALS, __IBMCPP__

detection

_CPPLIB_VER

detection

_CPPLIB_VER

V.R.0

BOOST_LIB_STD_COMO

Comeau Computing Standard C++ Library. Version number available as major.

Symbol

Version

__LIBCOMO__

detection

__LIBCOMO_VERSION__

V.0.0

BOOST_LIB_STD_MSIPL

Modena Software Lib++ Standard C++ Library.

Symbol

Version

MSIPL_COMPILE_H

detection

__MSIPL_COMPILE_H

detection

BOOST_LIB_STD_MSL

Metrowerks Standard C++ Library. Version number available as major, minor, and patch.

Symbol

Version

__MSL_CPP__

detection

__MSL__

detection

__MSL_CPP__

V.R.P

__MSL__

V.R.P

BOOST_LIB_STD_RW

Roguewave Standard C++ library. If available version number as major, minor, and patch.

Symbol

Version

__STD_RWCOMPILER_H__

detection

_RWSTD_VER

detection

_RWSTD_VER

V.R.P

BOOST_LIB_STD_SGI

SGI Standard C++ library. If available version number as major, minor, and patch.

Symbol

Version

__STL_CONFIG_H

detection

__SGI_STL

V.R.P

BOOST_LIB_STD_GNU

GNU libstdc++ Standard C++ library. Version number available as year (from 1970), month, and day.

Symbol

Version

__GLIBCXX__

detection

__GLIBCPP__

detection

__GLIBCXX__

V.R.P

__GLIBCPP__

V.R.P

BOOST_LIB_STD_STLPORT

STLport Standard C++ library. Version number available as major, minor, and patch.

Symbol

Version

__SGI_STL_PORT

detection

_STLPORT_VERSION

detection

_STLPORT_MAJOR, _STLPORT_MINOR, _STLPORT_PATCHLEVEL

V.R.P

_STLPORT_VERSION

V.R.P

__SGI_STL_PORT

V.R.P

BOOST_LIB_STD_IBM

IBM VACPP Standard C++ library.

Symbol

Version

__IBMCPP__

detection

BOOST_OS_AIX

IBM AIX operating system. Version number available as major, minor, and patch.

Symbol

Version

_AIX

detection

__TOS_AIX__

detection

_AIX43

4.3.0

_AIX41

4.1.0

_AIX32

3.2.0

_AIX3

3.0.0

BOOST_OS_AMIGAOS

AmigaOS operating system.

Symbol

Version

AMIGA

detection

__amigaos__

detection

BOOST_OS_ANDROID

Android operating system.

Symbol

Version

__ANDROID__

detection

BOOST_OS_BEOS

BeOS operating system.

Symbol

Version

__BEOS__

detection

BOOST_OS_BSD

BSD operating system.

BSD has various branch operating systems possible and each detected individually. This detects the following variations and sets a specific version number macro to match:

[Note] Note

The general BOOST_OS_BSD is set in all cases to indicate some form of BSD. If the above variants is detected the corresponding macro is also set.

Symbol

Version

BSD

detection

_SYSTYPE_BSD

detection

BSD4_2

4.2.0

BSD4_3

4.3.0

BSD4_4

4.4.0

BSD

V.R.0

BOOST_OS_CYGWIN

Cygwin evironment.

Symbol

Version

__CYGWIN__

detection

BOOST_OS_HAIKU

Haiku operating system.

Symbol

Version

__HAIKU__

detection

BOOST_OS_HPUX

HP-UX operating system.

Symbol

Version

hpux

detection

_hpux

detection

__hpux

detection

BOOST_OS_IOS

iOS operating system.

Symbol

Version

__APPLE__

detection

__MACH__

detection

__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__

detection

__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__

__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__*1000

BOOST_OS_IRIX

IRIX operating system.

Symbol

Version

sgi

detection

__sgi

detection

BOOST_OS_LINUX

Linux operating system.

Symbol

Version

linux

detection

__linux

detection

BOOST_OS_MACOS

Mac OS operating system.

Symbol

Version

macintosh

detection

Macintosh

detection

__APPLE__

detection

__MACH__

detection

__APPLE__, __MACH__

10.0.0

otherwise

9.0.0

BOOST_OS_OS400

IBM OS/400 operating system.

Symbol

Version

__OS400__

detection

BOOST_OS_QNX

QNX operating system. Version number available as major, and minor if possible. And version 4 is specifically detected.

Symbol

Version

__QNX__

detection

__QNXNTO__

detection

_NTO_VERSION

V.R.0

__QNX__

4.0.0

BOOST_OS_SOLARIS

Solaris operating system.

Symbol

Version

sun

detection

__sun

detection

BOOST_OS_UNIX

Unix Environment operating system.

Symbol

Version

unix

detection

__unix

detection

_XOPEN_SOURCE

detection

_POSIX_SOURCE

detection

BOOST_OS_SVR4

SVR4 Environment operating system.

Symbol

Version

__sysv__

detection

__SVR4

detection

__svr4__

detection

_SYSTYPE_SVR4

detection

BOOST_OS_VMS

VMS operating system.

Symbol

Version

VMS

detection

__VMS

detection

__VMS_VER

V.R.P

BOOST_OS_WINDOWS

Microsoft Windows operating system.

Symbol

Version

_WIN32

detection

_WIN64

detection

__WIN32__

detection

__TOS_WIN__

detection

__WINDOWS__

detection

BOOST_OS_BSD_BSDI

BSDi BSD/OS operating system.

Symbol

Version

__bsdi__

detection

BOOST_OS_BSD_DRAGONFLY

DragonFly BSD operating system.

Symbol

Version

__DragonFly__

detection

BOOST_OS_BSD_FREE

FreeBSD operating system.

Symbol

Version

__FreeBSD__

detection

__FreeBSD_version

V.R.P

BOOST_OS_BSD_NET

NetBSD operating system.

Symbol

Version

__NETBSD__

detection

__NetBSD__

detection

__NETBSD_version

V.R.P

NetBSD0_8

0.8.0

NetBSD0_9

0.9.0

NetBSD1_0

1.0.0

__NetBSD_Version

V.R.P

BOOST_OS_BSD_OPEN

OpenBSD operating system.

Symbol

Version

__OpenBSD__

detection

OpenBSD2_0

2.0.0

OpenBSD2_1

2.1.0

OpenBSD2_2

2.2.0

OpenBSD2_3

2.3.0

OpenBSD2_4

2.4.0

OpenBSD2_5

2.5.0

OpenBSD2_6

2.6.0

OpenBSD2_7

2.7.0

OpenBSD2_8

2.8.0

OpenBSD2_9

2.9.0

OpenBSD3_0

3.0.0

OpenBSD3_1

3.1.0

OpenBSD3_2

3.2.0

OpenBSD3_3

3.3.0

OpenBSD3_4

3.4.0

OpenBSD3_5

3.5.0

OpenBSD3_6

3.6.0

OpenBSD3_7

3.7.0

OpenBSD3_8

3.8.0

OpenBSD3_9

3.9.0

OpenBSD4_0

4.0.0

OpenBSD4_1

4.1.0

OpenBSD4_2

4.2.0

OpenBSD4_3

4.3.0

OpenBSD4_4

4.4.0

OpenBSD4_5

4.5.0

OpenBSD4_6

4.6.0

OpenBSD4_7

4.7.0

OpenBSD4_8

4.8.0

OpenBSD4_9

4.9.0

BOOST_PLAT_MINGW

MinGW platform. Version number available as major, minor, and patch.

Symbol

Version

__MINGW32__

detection

__MINGW64__

detection

__MINGW64_VERSION_MAJOR, __MINGW64_VERSION_MINOR

V.R.0

__MINGW32_VERSION_MAJOR, __MINGW32_VERSION_MINOR

V.R.0

BOOST_PLAT_WINDOWS_DESKTOP

Symbol

Version

!WINAPI_FAMILY

detection

WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP

detection

BOOST_PLAT_WINDOWS_PHONE

Symbol

Version

WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP

detection

BOOST_PLAT_WINDOWS_RUNTIME

Symbol

Version

WINAPI_FAMILY == WINAPI_FAMILY_APP

detection

WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP

detection

BOOST_PLAT_WINDOWS_STORE

Symbol

Version

WINAPI_FAMILY == WINAPI_FAMILY_APP

detection

SIMD predefs depend on compiler options. For example, you will have to add the option -msse3 to clang or gcc to enable SSE3. SIMD predefs are also inclusive. This means that if SSE3 is enabled, then every other extensions with a lower version number will implicitly be enabled and detected. However, some extensions are CPU specific, they may not be detected nor enabled when an upper version is enabled.

[Note] Note

SSE(1) and SSE2 are automatically enabled by default when using x86-64 architecture.

To check if any SIMD extension has been enabled, you can use:

#include <boost/predef/hardware/simd.h>
#include <iostream>

int main()
{
#if defined(BOOST_HW_SIMD_AVAILABLE)
    std::cout << "SIMD detected!" << std::endl;
#endif
    return 0;
}

When writing SIMD specific code, you may want to check if a particular extension has been detected. To do so you have to use the right architecture predef and compare it. Those predef are of the form BOOST_HW_SIMD_"ARCH" (where "ARCH" is either ARM, PPC, or X86). For example, if you compile code for x86 architecture, you will have to use BOOST_HW_SIMD_X86. Its value will be the version number of the most recent SIMD extension detected for the architecture.

To check if an extension has been enabled:

#include <boost/predef/hardware/simd.h>
#include <iostream>

int main()
{
#if BOOST_HW_SIMD_X86 >= BOOST_HW_SIMD_X86_SSE3_VERSION
    std::cout << "This is SSE3!" << std::endl;
#endif
    return 0;
}
[Note] Note

The _VERSION defines that map version number to actual real identifiers. This way it is easier to write comparisons without messing up with version numbers.

To "stricly" check the most recent detected extension:

#include <boost/predef/hardware/simd.h>
#include <iostream>

int main()
{
#if BOOST_HW_SIMD_X86 == BOOST_HW_SIMD_X86_SSE3_VERSION
    std::cout << "This is SSE3 and this is the most recent enabled extension!"
        << std::endl;
#endif
    return 0;
}

Because of the version systems of predefs and of the inclusive property of SIMD extensions macros, you can easily check for ranges of supported extensions:

#include <boost/predef/hardware/simd.h>
#include <iostream>

int main()
{
#if BOOST_HW_SIMD_X86 >= BOOST_HW_SIMD_X86_SSE2_VERSION &&\
    BOOST_HW_SIMD_X86 <= BOOST_HW_SIMD_X86_SSSE3_VERSION
    std::cout << "This is SSE2, SSE3 and SSSE3!" << std::endl;
#endif
    return 0;
}
[Note] Note

Unlike gcc and clang, Visual Studio does not allow you to specify precisely the SSE variants you want to use, the only detections that will take place are SSE, SSE2, AVX and AVX2. For more informations, see here.

BOOST_HW_SIMD

The SIMD extension detected for a specific architectures. Version number depends on the detected extension.

Symbol

Version

BOOST_HW_SIMD_X86_AVAILABLE

detection

BOOST_HW_SIMD_X86_AMD_AVAILABLE

detection

BOOST_HW_SIMD_ARM_AVAILABLE

detection

BOOST_HW_SIMD_PPC_AVAILABLE

detection

BOOST_HW_SIMD_X86

The SIMD extension for x86 (if detected). Version number depends on the most recent detected extension.

Symbol

Version

__SSE__

detection

_M_X64

detection

_M_IX86_FP >= 1

detection

__SSE2__

detection

_M_X64

detection

_M_IX86_FP >= 2

detection

__SSE3__

detection

__SSSE3__

detection

__SSE4_1__

detection

__SSE4_2__

detection

__AVX__

detection

__FMA__

detection

__AVX2__

detection

Symbol

Version

__SSE__

BOOST_HW_SIMD_X86_SSE_VERSION

_M_X64

BOOST_HW_SIMD_X86_SSE_VERSION

_M_IX86_FP >= 1

BOOST_HW_SIMD_X86_SSE_VERSION

__SSE2__

BOOST_HW_SIMD_X86_SSE2_VERSION

_M_X64

BOOST_HW_SIMD_X86_SSE2_VERSION

_M_IX86_FP >= 2

BOOST_HW_SIMD_X86_SSE2_VERSION

__SSE3__

BOOST_HW_SIMD_X86_SSE3_VERSION

__SSSE3__

BOOST_HW_SIMD_X86_SSSE3_VERSION

__SSE4_1__

BOOST_HW_SIMD_X86_SSE4_1_VERSION

__SSE4_2__

BOOST_HW_SIMD_X86_SSE4_2_VERSION

__AVX__

BOOST_HW_SIMD_X86_AVX_VERSION

__FMA__

BOOST_HW_SIMD_X86_FMA3_VERSION

__AVX2__

BOOST_HW_SIMD_X86_AVX2_VERSION

BOOST_HW_SIMD_X86_AMD

The SIMD extension for x86 (AMD) (if detected). Version number depends on the most recent detected extension.

Symbol

Version

__SSE4A__

detection

__FMA4__

detection

__XOP__

detection

BOOST_HW_SIMD_X86

detection

Symbol

Version

__SSE4A__

BOOST_HW_SIMD_X86_SSE4A_VERSION

__FMA4__

BOOST_HW_SIMD_X86_FMA4_VERSION

__XOP__

BOOST_HW_SIMD_X86_XOP_VERSION

BOOST_HW_SIMD_X86

BOOST_HW_SIMD_X86

[Note] Note

This predef includes every other x86 SIMD extensions and also has other more specific extensions (FMA4, XOP, SSE4a). You should use this predef instead of BOOST_HW_SIMD_X86 to test if those specific extensions have been detected.

BOOST_HW_SIMD_ARM

The SIMD extension for ARM (if detected). Version number depends on the most recent detected extension.

Symbol

Version

__ARM_NEON__

detection

__aarch64__

detection

_M_ARM

detection

Symbol

Version

__ARM_NEON__

BOOST_HW_SIMD_ARM_NEON_VERSION

__aarch64__

BOOST_HW_SIMD_ARM_NEON_VERSION

_M_ARM

BOOST_HW_SIMD_ARM_NEON_VERSION

BOOST_HW_SIMD_PPC

The SIMD extension for PowerPC (if detected). Version number depends on the most recent detected extension.

Symbol

Version

__VECTOR4DOUBLE__

detection

__ALTIVEC__

detection

__VEC__

detection

__VSX__

detection

Symbol

Version

__VECTOR4DOUBLE__

BOOST_HW_SIMD_PPC_QPX_VERSION

__ALTIVEC__

BOOST_HW_SIMD_PPC_VMX_VERSION

__VEC__

BOOST_HW_SIMD_PPC_VMX_VERSION

__VSX__

BOOST_HW_SIMD_PPC_VSX_VERSION

Those defines represent x86 SIMD extensions versions.

[Note] Note

You MUST compare them with the predef BOOST_HW_SIMD_X86.

BOOST_HW_SIMD_X86_MMX_VERSION

The MMX x86 extension version number.

Version number is: 0.99.0.

BOOST_HW_SIMD_X86_SSE_VERSION

The SSE x86 extension version number.

Version number is: 1.0.0.

BOOST_HW_SIMD_X86_SSE2_VERSION

The SSE2 x86 extension version number.

Version number is: 2.0.0.

BOOST_HW_SIMD_X86_SSE3_VERSION

The SSE3 x86 extension version number.

Version number is: 3.0.0.

BOOST_HW_SIMD_X86_SSSE3_VERSION

The SSSE3 x86 extension version number.

Version number is: 3.1.0.

BOOST_HW_SIMD_X86_SSE4_1_VERSION

The SSE4_1 x86 extension version number.

Version number is: 4.1.0.

BOOST_HW_SIMD_X86_SSE4_2_VERSION

The SSE4_2 x86 extension version number.

Version number is: 4.2.0.

BOOST_HW_SIMD_X86_AVX_VERSION

The AVX x86 extension version number.

Version number is: 5.0.0.

BOOST_HW_SIMD_X86_FMA3_VERSION

The FMA3 x86 extension version number.

Version number is: 5.2.0.

BOOST_HW_SIMD_X86_AVX2_VERSION

The AVX2 x86 extension version number.

Version number is: 5.3.0.

BOOST_HW_SIMD_X86_MIC_VERSION

The MIC (Xeon Phi) x86 extension version number.

Version number is: 9.0.0.

Those defines represent x86 (AMD specific) SIMD extensions versions.

[Note] Note

You MUST compare them with the predef BOOST_HW_SIMD_X86_AMD.

BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION

SSE4A x86 extension (AMD specific).

Version number is: 4.0.0.

BOOST_HW_SIMD_X86_AMD_FMA4_VERSION

FMA4 x86 extension (AMD specific).

Version number is: 5.1.0.

BOOST_HW_SIMD_X86_AMD_XOP_VERSION

XOP x86 extension (AMD specific).

Version number is: 5.1.1.

Those defines represent ARM SIMD extensions versions.

[Note] Note

You MUST compare them with the predef BOOST_HW_SIMD_ARM.

BOOST_HW_SIMD_ARM_NEON_VERSION

The NEON ARM extension version number.

Version number is: 1.0.0.

Those defines represent Power PC SIMD extensions versions.

[Note] Note

You MUST compare them with the predef BOOST_HW_SIMD_PPC.

BOOST_HW_SIMD_PPC_VMX_VERSION

The VMX powerpc extension version number.

Version number is: 1.0.0.

BOOST_HW_SIMD_PPC_VSX_VERSION

The VSX powerpc extension version number.

Version number is: 1.1.0.

BOOST_HW_SIMD_PPC_QPX_VERSION

The QPX powerpc extension version number.

Version number is: 2.0.0.

BOOST_ENDIAN_*

Detection of endian memory ordering. There are four defined macros in this header that define the various generally possible endian memory orderings:

  • BOOST_ENDIAN_BIG_BYTE, byte-swapped big-endian.
  • BOOST_ENDIAN_BIG_WORD, word-swapped big-endian.
  • BOOST_ENDIAN_LITTLE_BYTE, byte-swapped little-endian.
  • BOOST_ENDIAN_LITTLE_WORD, word-swapped little-endian.

The detection is conservative in that it only identifies endianness that it knows for certain. In particular bi-endianness is not indicated as is it not practically possible to determine the endianness from anything but an operating system provided header. And the currently known headers do not define that programatic bi-endianness is available.

This implementation is a compilation of various publicly available information and acquired knowledge:

  1. The indispensable documentation of "Pre-defined Compiler Macros" Endianness.
  2. The various endian specifications available in the Wikipedia computer architecture pages.
  3. Generally available searches for headers that define endianness.
BOOST_VERSION_NUMBER
BOOST_VERSION_NUMBER(major,minor,patch)

Defines standard version numbers, with these properties:

  • Decimal base whole numbers in the range [0,1000000000). The number range is designed to allow for a (2,2,5) triplet. Which fits within a 32 bit value.
  • The major number can be in the [0,99] range.
  • The minor number can be in the [0,99] range.
  • The patch number can be in the [0,99999] range.
  • Values can be specified in any base. As the defined value is an constant expression.
  • Value can be directly used in both preprocessor and compiler expressions for comparison to other similarly defined values.
  • The implementation enforces the individual ranges for the major, minor, and patch numbers. And values over the ranges are truncated (modulo).
BOOST_VERSION_NUMBER_MAJOR(N), BOOST_VERSION_NUMBER_MINOR(N), BOOST_VERSION_NUMBER_PATCH(N)

The macros extract the major, minor, and patch portion from a well formed version number resulting in a preprocessor expression in the range of [0,99] or [0,99999] for the major and minor, or patch numbers respectively.

BOOST_PREDEF_MAKE_.. macros

These set of macros decompose common vendor version number macros which are composed version, revision, and patch digits. The naming convention indicates:

  • The base of the specified version number. "BOOST_PREDEF_MAKE_0X" for hexadecimal digits, and "BOOST_PREDEF_MAKE_10" for decimal digits.
  • The format of the vendor version number. Where "V" indicates the version digits, "R" indicates the revision digits, "P" indicates the patch digits, and "0" indicates an ignored digit.

Macros are:

BOOST_PREDEF_MAKE_0X_VRP(V)

BOOST_PREDEF_MAKE_0X_VVRP(V)

BOOST_PREDEF_MAKE_0X_VRPP(V)

BOOST_PREDEF_MAKE_0X_VVRR(V)

BOOST_PREDEF_MAKE_0X_VRRPPPP(V)

BOOST_PREDEF_MAKE_0X_VVRRP(V)

BOOST_PREDEF_MAKE_0X_VRRPP000(V)

BOOST_PREDEF_MAKE_0X_VVRRPP(V)

BOOST_PREDEF_MAKE_10_VPPP(V)

BOOST_PREDEF_MAKE_10_VRP(V)

BOOST_PREDEF_MAKE_10_VRP000(V)

BOOST_PREDEF_MAKE_10_VRPP(V)

BOOST_PREDEF_MAKE_10_VRR(V)

BOOST_PREDEF_MAKE_10_VRRPP(V)

BOOST_PREDEF_MAKE_10_VRR000(V)

BOOST_PREDEF_MAKE_10_VV00(V)

BOOST_PREDEF_MAKE_10_VVRR(V)

BOOST_PREDEF_MAKE_10_VVRRPP(V)

BOOST_PREDEF_MAKE_10_VVRR0PP00(V)

BOOST_PREDEF_MAKE_10_VVRR0PPPP(V)

BOOST_PREDEF_MAKE_10_VVRR00PP00(V)

BOOST_PREDEF_MAKE_*.. date macros

Date decomposition macros return a date in the relative to the 1970 Epoch date. If the month is not available, January 1st is used as the month and day. If the day is not available, but the month is, the 1st of the month is used as the day.

BOOST_PREDEF_MAKE_DATE(Y,M,D)

BOOST_PREDEF_MAKE_YYYYMMDD(V)

BOOST_PREDEF_MAKE_YYYY(V)

BOOST_PREDEF_MAKE_YYYYMM(V)


PrevUpHomeNext