VC预定义宏

一、ANSI C标准预定义宏

__LINE__ 、__FILE__ 、__DATE__ 、__TIME__、__STDC__ 、__TIMESTAMP__

 

MSDN上的注解:

__DATE__

The compilation date of the current source file. The date is a string literal of the form Mmm dd yyyy.

The month name Mmm is the same as for dates generated by the library function asctimedeclared in

TIME.H.

 

__FILE__

The name of the current source file. __FILE__ expands to a string surrounded by double quotation

marks.

 

__LINE__

The line number in the current source file. The line number is a decimal integer constant. It can be

altered with a #line directive.

 

__STDC__

Indicates full conformance with the ANSI C standard. Defined as the integer constant 1 only if the /Za

compiler option is given and you are not compiling C++ code; otherwise is undefined.

 

__TIME__

The most recent compilation time of the current source file. The time is a string literal of the

form hh:mm:ss.

 

__TIMESTAMP__

The date and time of the last modification of the current source file, expressed as a string literal in

the form Ddd Mmm Date hh:mm:ss yyyy, where Ddd is the abbreviated day of the week andDate is

aninteger from 1 to 31.

 

二 、VC指定的预定义宏

_ATL_VER 、_CHAR_UNSIGNED 、__CLR_VER 、__cplusplus_cli 、__COUNTER____cplusplus_CPPLIB_VER 、_CPPRTTI 、_CPPUNWIND 、_DEBUG_DLL、__FUNCDNAME__ 、__FUNCSIG__ 、__FUNCTION__ 、_INTEGRAL_MAX_BITS 、_M_ALPHA 、_M_CEE 、_M_CEE_PURE 、_M_CEE_SAFE 、_M_IX86 、_M_IA64 、_M_IX86_FP 、_M_MPPC 、_M_MRX000 、_M_PPC 、_M_X64 、_MANAGED 、_MFC_VER 、__MSVC_RUNTIME_CHECKS 、_MT 、_NATIVE_WCHAR_T_DEFINED 、_OPENMP 、_VC_NODEFAULTLIB 、_WCHAR_T_DEFINED 、_WIN32 、_WIN64 、_Wp64 。

 

摘选部分MSDN上的注解(更多了解到http://msdn.microsoft.com/en-us/library/b0084kay.aspx):

__COUNTER__

Expands to an integer starting with 0 and incrementing by 1 every time it is used in a compiland.

 

__cplusplus

Defined for C++ programs only.

 

_DEBUG

Defined when compiling with /LDd, /MDd, and /MTd.

 

_DLL

Defined when /MD or /MDd (Multithread DLL) is specified.

 

_MT

Defined when /MD or /MDd (Multithreaded DLL) or /MT or /MTd (Multithreaded) is specified.

 

_WCHAR_T_DEFINED

Defined when /Zc:wchar_t is used or if wchar_t is 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.

原文地址:https://www.cnblogs.com/qinfengxiaoyue/p/2519689.html