Skip to content

Instantly share code, notes, and snippets.

@GroverChouT
Last active June 29, 2021 05:28
Show Gist options
  • Save GroverChouT/3be245c9f7cdaca2c468e927ca0c7584 to your computer and use it in GitHub Desktop.
Save GroverChouT/3be245c9f7cdaca2c468e927ca0c7584 to your computer and use it in GitHub Desktop.
__linux__ Defined on Linux
__sun Defined on Solaris
__FreeBSD__ Defined on FreeBSD
__NetBSD__ Defined on NetBSD
__OpenBSD__ Defined on OpenBSD
__APPLE__ Defined on Mac OS X
__hpux Defined on HP-UX
__osf__ Defined on Tru64 UNIX (formerly DEC OSF1)
__sgi Defined on Irix
_AIX Defined on AIX
_WIN32 Defined on Windows
_WIN64 Defined on Windows 64 bit (implies _WIN32)
__ANDROID__ Defined on Android (implies __linux__)
__ros__ Defined on Akaros
__Fuchsia__ Defined on Fuschia
_MSC_VER Visual Studio
__GNUC__ gcc
__clang__ clang
__MINGW32__ Mingw-w64 32 bit
__MINGW64__ Mingw-w64 64 bit
C89 __STDC__ ANSI X3.159-1989
C90 __STDC__ ISO/IEC 9899:1990
C94 __STDC_VERSION__ = 199409L ISO/IEC 9899-1:1994
C99 __STDC_VERSION__ = 199901L ISO/IEC 9899:1999
C11 __STDC_VERSION__ = 201112L ISO/IEC 9899:2011
C18 __STDC_VERSION__ = 201710L ISO/IEC 9899:2018
C++98 __cplusplus = 199711L ISO/IEC 14882:1998
C++11 __cplusplus = 201103L ISO/IEC 14882:2011
C++14 __cplusplus = 201402L ISO/IEC 14882:2014
C++17 __cplusplus = 201703L ISO/IEC 14882:2017
C++/CLI __cplusplus_cli = 200406L ECMA-372
https://sourceforge.net/p/predef/wiki/Standards/
__cplusplus
C++ pre-C++98: __cplusplus = 1
C++98: __cplusplus = 199711L
C++11: __cplusplus = 201103L
C++14: __cplusplus = 201402L
C++17: __cplusplus = 201703L
https://stackoverflow.com/questions/2324658/how-to-determine-the-version-of-the-c-standard-used-by-the-compiler
VS _MSC_VER _MSC_FULL_VER
1 800
3 900
4 1000
4 1020
5 1100
6 1200
6 SP6 1200 12008804
7 1300 13009466
7.1 (2003) 1310 13103077
8 (2005) 1400 140050727
9 (2008) 1500 150021022
9 SP1 1500 150030729
10 (2010) 1600 160030319
10 (2010) SP1 1600 160040219
11 (2012) 1700 170050727
12 (2013) 1800 180021005
14 (2015) 1900 190023026
14 (2015 Update 1) 1900 190023506
14 (2015 Update 2) 1900 190023918
14 (2015 Update 3) 1900 190024210
15 (2017 Update 1 & 2) 1910 191025017
15 (2017 Update 3 & 4) 1911
15 (2017 Update 5) 1912
__i386__
__x86_64__
__powerpc64__
__arm__
__aarch64__
https://sourceforge.net/p/predef/wiki/Compilers/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment