Preprocessor predefined macros

Source: Internet
Author: User

From (http://www.cnblogs.com/whiteyun/archive/2011/07/07/2099918.html)

ANSI compliant predefined macros:

 

_ Date __: Indicates the date when the current source file is compiled. Format: Month/day/year (MMM dd yyyy ). _ File __: Name of the source file being processed. _ Line __: Indicates the row of the source file being processed. You can use the # Line command to modify it. _ Stdc __: Stands for the ansi c standard. It is defined as a constant integer 1 only when/Za is specified in the compiler option and is not compiled into a C ++ program; otherwise, it is not defined. _ Time __: Indicates the time when the source file was last compiled. Format: hour/minute/second (HH: mm: SS ). _ Timestamp __: Indicates the date and time when the source file was last modified. Format: DDD Mmm dd hh: mm: ss yyyy. Here, DDD is the abbreviation of the week.

 

Microsoft-related macros:

 

_ Atl_ver: Defines the ATL version. _ Char_unsigned: Set the default char type to unsigned. It is defined only when the compiler option/J is specified. _ Clr_ver: Specifies the version of the Common Language Runtime (CLR) during application compilation. The format is mmmbbbbb, where M is the main version of CLR, mm is the next version of CLR, and bbbbb is the build number. _ Cplusplus_cli: Defined only when/CLR,/CLR: pure or/CLR: Safe is used for compilation. The value of _ cplusplus_cli is 200406. _ Counter __: An integer starting from 0. Each time it appears, the value increases by 1. You can use _ counter _ as the prefix to generate a unique name. _ CplusplusIt is defined only when a C ++ program is compiled. It is generally used to distinguish between a C program and a C ++ program. _ Cpplib_ver: If the program contains any header file of the C ++ standard library, _ cpplib_ver is defined. Displays the version of the header file in use. _ Cpprtti: Used to identify whether the compiler specifies rtti. If/GR is set in the compiler option (enable the runtime type information mechanism-rtti), _ cpprtti is defined. _ Cppunwind: Used to identify whether the compiler enables exception handling. If/GX is set in the compiler option, _ cpprtti is defined. _ Debug: Used to identify the debug mode. It is defined only when the compiler specifies/LDD,/MDD or/MTD. _ DLL: This parameter is defined only when/MD or/MDD (multithread DLL) is specified in the compiler option. _ Funcdname __: Valid only within the function. Returns the name of the function modified by the compiler. If/EP or/P is set in the compiler option, _ funcdname _ is not defined. _ Funcsig __: It is valid only within the function and returns the signature of the function. A function signature consists of the function name, parameter list, return type, and included namespace. If it is a member function, its class name and const/volatile qualifier will also be part of the signature. In a 64-bit operating system, __cdecl is the default function call method. If/EP or/P is set in the compiler options, _ funcsig _ is not defined. _ Function __: Valid only within the function. Returns the unmodified name of the function. If/EP or/P is set in the compiler option, _ function _ is undefined. _ Integral_max_bits: Indicates the maximum bits of the integer type ). _ M_alpha: Defined for the DEC Alpha platform. (Not supported now) _ M_cee: It is defined when any form of/CLR (/CLR: oldsyntax, for example,/CLR: Safe) is used for compilation. _ M_cee_pure: Defined when/CLR: Pure is used for compilation. _ M_cee_safe: Defined when/CLR: Safe is used for compilation. _ M_ix86: Defines the x86 processor architecture. If the value is 300, the value is 80386. If the value is 400, the value is 80486. _ M_ia64: Defined for the itanium Processor family's 64-bit processor (IA64) architecture. _ M_ix86_fp: Indicates the value of the compiler option/arch. 0:/arch not specified; 1: specified/arch: SSE; 2: specified/arch: sse2 _ M_mppc: Defined for the Power Macintosh platform. (Not supported now) _ M_mrx000: Defined for the MIPs platform. (Not supported now) _ M_ppc: Defined for the PowerPC platform. (Not supported now) _ M_x64: Defines the x64 processor architecture. _ Managed: Defined when the compiler option specifies/CLR, its value is 1. _ Mfc_ver: Specify the MFC version. For example, 0x0700 indicates MFC version 7. _ Msc_build: Indicates the revision number of the compiler version number. The revision number is the fourth part of the version number separated by periods. For example, if the version of the VC ++ compiler is 15.00.20706.01, the value of _ msc_build is 1. _ Msc_extensions: It is defined when the compiler option/ze (default) is specified, and its value is 1. _ Msc_full_ver: Indicates the main, minor version, and build number of the compiler. The main version number is the first part of the entire version number, the minor version number is the second part of the entire version number, and the build number is the third part of the entire version number. For example, if the version of the VC ++ compiler is 15.00.20706.01, the value of _ msc_full_ver is 150020706. You can type CL in the command line.
/? To view the version number of the compiler. _ Msc_ver: Indicates the main version number of the compiler. For example, if the version of the VC ++ compiler is 15.00.20706.01, the value of _ msc_ver is 1500. _ Msvc_runtime_checks: Defined when one of the compiler options/RTC (/RTCs or/rtcu or/rtc1) is specified. _ Mt: Defined when the compiler options/MD or/MDD (multithreaded DLL) or/Mt or/MTD (multithreaded) are specified. _ Native_wchar_t_defined: It is defined when the compiler option/ZC: wchar_t is specified (wchar_t is considered as a built-in type. _ OpenMP: If a compiler option or OpenMP is specified, an integer representing the date of OpenMP in Visual C ++ is returned. _ Vc_nodefaultlib: It is defined when the compiler option/ZL is specified (the default library name is ignored. _ Wchar_t_defined: Wchar_t is defined when the compiler option/ZC: wchar_t is specified or the system header file contained in the project is defined. _ Win32: Defined for Win32 and win64 applications. There is always a definition. _ Win64: Defined for win64 applications. _ Wp64: Defined when the compiler option/wp64 is specified.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.