Macro |
Description |
_atl_ver |
Defines the ATL version, encoded as an integer literal. |
__avx__ |
Defined when /arch:avx or /arch:avx2 is specified. |
__avx2__ |
Defined when /arch:avx2 is specified. |
_char_unsigned |
The Default char type is unsigned. Defined when/j is specified. |
__clr_ver |
Defines the version of the common language runtime used when the Application was compiled. The value returned is a integer literal encoded in the following format: mmmbbbbb p> Where,
-
m is the major version of the runtime
-
mm is the minor version of the runtime
-
bbbbb is the build number.
//clr_ver.cpp//compile with:/clrusing namespace System;int main () {Console::WriteLine (__clr_v
ER);} |
__cplusplus_cli |
Defined when you compile with/ CLR, /clr:pure, or /clr:safe. Value of __CPLUSPLUS_CLI is the integer literal 200406. __CPLUSPLUS_CLI is in effect throughout the translation unit. cplusplus_cli.cpp//compile with:/clr#include "stdio.h" int main () { #ifdef __cplusplus_cli printf ("%d\n", _ _CPLUSPLUS_CLI); #else printf ("Not defined\n"); #endif} |
__cplusplus_winrt |
Defined when do the /zw option to compile. The value of __CPLUSPLUS_WINRT is the integer literal 201009. |
__counter__ |
Expands to an integer literal starting with 0 and incrementing by 1 every time it's used in a source file or included Hea DERs of the source file. __counter__ remembers it state is the precompiled headers. The following example uses __counter__ to assign unique identifiers to three different objects of the same type. First, assume the following class definition. The constructor takes an integer as a parameter. C++Initialize object with a read-only unique idexampleclass::exampleclass (int nID) {M_nid = NID;} int Exampleclass::getid () {return m_nid;}
In main, the application declares three objects of type ExampleClass, using __counter__ as the unique identif IER parameter. C++Demonstration of __counter__, assigns unique identifiers to// different objects of the same type int main (int argc , char** argv) {//__COUNTER__ is initially defined as 0exampleClass E1 (__counter__);//have been referenced, __counter__ is now defined as 1exampleClass E2 (__COUNTER__);//__counter__ is now defined as 2exampleClass E3 (__counter__);p rintf ("E1 ID:%i\n ", E1. GetID ());p rintf ("E2 ID:%i\n", E2. GetID ());p rintf ("E3 ID:%i\n", E3. GetID ());//Output//------------------------------//E1 id:0//E2 id:1//E3 id:2 return 0;}
|
__cplusplus |
Defined for C + + programs only. |
_cpprtti |
Defined for code compiled WITH/GR (Enable run-time Type information). |
_cppunwind |
Defined for code compiled by using one of the The/eh (Exception handling Model) flags. |
_debug |
Defined when you compile With/ldd,/MDd, AND/MTD. |
_dll |
Defined when/md OR/MDD (multithreaded DLL) is specified. |
__funcdname__ |
Valid only in a function. Defines the decorated name of the enclosing function as a string literal. __funcdname__ is not expanded if your use the /ep or /p compiler option. The following example uses The __funcdname__, __funcsig__, and __function__ macros to display FUNCTION information. c++ //demonstrates functionality of __function__, __funcdname__, and __funcsig__ macros void Examplefunction () {printf ("Function name:%s\n", __function__);p rintf ("Decorated Function name:%s\n", __funcdname__); printf ("Function Signature:%s\n", __funcsig__);//Sample output //------------------------------------------- ------ //function name:examplefunction //decorated function name: [email protected] @YAXXZ // Function signature:void __cdecl examplefunction (void)} |
__funcsig__ |
Valid only in a function. Defines the signature of the enclosing function as a string literal. __funcsig__ is not expanded if you use the/ep or/p compiler option. On a 64-bit operating system, the calling convention are __cdecl by default. See __funcdname__ for an example. |
__function__ |
Valid only in a function. Defines the undecorated name of the enclosing function as a string literal. __function__ is not expanded if you use the/ep or/p compiler option. See __funcdname__ for an example. |
_integral_max_bits |
Reports the maximum size (in bits) for a integral type as an integer literal. Integral_max_bits.cpp#include <stdio.h>int Main () { printf ("%d\n", _integral_max_bits);} |
_m_amd64 |
Defined for compilations that target x64 processors. |
_m_arm |
Defined for compilations this target ARM processors. |
_m_cee |
Defined for a compilation so uses any form of/ CLR (/clr:oldsyntax, /clr:safe, for example). |
_m_cee_pure |
Defined for a compilation that uses /clr:pure. |
_m_cee_safe |
Defined for a compilation that uses /clr:safe. |
_m_ix86 |
Defined for compilations that target x86 processors. This isn't defined for x64 processors. |
_m_arm_fp |
Expands to a integer literal value indicating which /arch compiler option was used:
In the range 30-39 if no /arch ARM option is specified, indicating the default architecture for ARM is used ( vfpv3).
In the range 40-49 if /arch:vfpv4 is used.
See/arch (x86) for more information.
|
_m_ix86_fp |
Expands to an integer literal value indicating Which /arch compiler option was used:
-
0 if /arch:ia32 was used.
-
1 if /arch:sse was used.
-
2 if /arch:sse2 , /arch:avx or /arch:avx2 was used. This value was the default if /arch was not specified. when /ARCH:AVX is specified, the macro __avx__ is Also Defined. when /arch:avx2 is specified, __avx__ and __avx2__ are also defined.
-
See /arch (x86) for more information.
|
_m_x64 |
Defined for compilations that target x64 processors. |
_managed |
Defined to being 1 WHEN/CLR is specified. |
_mfc_ver |
Defines the MFC version, encoded as an integer literal. |
_msc_build |
Evaluates to a integer literal that contains the revision number component of the compiler ' s version number. The revision number is the fourth component of the period-delimited version number. For example, if the version number of the Visual C + + compiler is 15.00.20706.01, the _msc_build macro evaluates t o 1. |
_msc_extensions |
This macro was defined when you compile with the/ze compiler option (the default). Its value, when defined, is 1. |
_msc_full_ver |
Evaluates to a integer literal that encodes the major, minor, and build number components of the compiler's version Numbe R. The major number is the first component of the period-delimited version number, and the minor number is the second Componen T, and the build number is the third component. For example, if the version number of the Visual C + + compiler is 15.00.20706.01, the _msc_full_ver macro Evaluate S to 150020706. Type cl/? at the command line to view the compiler ' s version number. |
_msc_ver |
Evaluates to a integer literal that encodes the major and minor number of the compiler ' s version number. The major number is the first component of the period-delimited version number and the minor number are the second Componen T. For example, if the version number of the Visual C + + compiler is 17.00.51106.1, the _msc_ver macro evaluates to 1 The Type cl/? at the command line to view the compiler's version number. |
__msvc_runtime_checks |
Defined when one of the THE/RTC compiler options is specified. |
_mt |
Defined when/md OR/MDD (multithreaded DLL) OR/MT OR/MTD (multithreaded) is specified. |
_native_wchar_t_defined |
Defined when/zc:wchar_t is used. |
_openmp |
Defined when compiling with/openmp, returns an integer literal representing the date of the OpenMP specification Implemen Ted by Visual C + +. _openmp_dir.cpp//compile with:/OPENMP #include <stdio.h> int main () { printf ("%d\n", _OPENMP);} |
_vc_nodefaultlib |
Defined when /zl is used; See/zl (Omit Default Library Name) for more information. |
_wchar_t_defined |
Defined when/zc:wchar_t is used or if wchar_t are Defined in a system header file included in your project. |
_win32 |
Defined for Applications for Win32 and Win64. Always defined. |
_win64 |
Defined for Applications for Win64. |
_wp64 |
Defined when Specifying/wp64. |