Predefined Macros

ANSI C recognizes five predefined macros, and the Microsoft C compiler extensions provide several more. The names of the ANSI predefined macros begin and end with two underscores. These macros take no arguments, and cannot be redefined.

The ANSI-recognized predefined macros are:

Macro Description

__DATE__ The translation date of the current source file. The date is a character string of the form Mmm dd yyyy. The month name Mmm is the same as for dates generated by the library function asctime declared in TIME.H. When the operating system does not provide the date, the default value for __DATE__ is MAY 03 1957.
__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 command-line option is given. Not defined under /Ze.
__TIME__ The translation time of the current source file. The time is a character string of the form hh:mm:ss. When the operating system does not provide the time, the default value for __TIME__ is 17:00:00.

Microsoft Specific

The Microsoft-specific predefined macros are described in the following list. Both forms of a predefined identifier (with and without an underscore) are defined if you specify the /Ze command line option (or, from within PWB, you must select Microsoft Extensions from the Additional Global Options dialog box from the C Compiler Options dialog box).

Identifier Function

MSDOS, _MSDOS Always defined. Identifies target operating system as MS-DOS.
M_I86, _M_I86 Always defined. Identifies target machine as a member of the 8086 family.
M_I8086, _M_I8086 Defined for 8086 and 8088 processors (default or /G0 option).
M_I286, _M_I286 Defined for 80286 processor (/G2 option).
M_I386, _M_I386 Defined for 80386 processor (/G3 option).
M_I86mM, _M_I86mM Always defined. Identifies memory model, where `m' is either T (tiny model), S (small model), C (compact model), M (medium model), L (large model), or H (huge model). If huge model is used, both M_I86LM and M_I86HM are defined. Small model is the default.
_MSC_VER Defines the compiler version in the form: ddd. Defined as 700 for Microsoft C/C++.
_CHAR_UNSIGNED Defined only when the /J option is given to make char unsigned by default.
__TIMESTAMP__ The date and time of the last modification of the source file, expressed as a string literal in the form: "Ddd Mmm hh:mm:ss yyyy".
_PCODE Translated to pcode. Defined when /Oq is enabled.
_QC Supported for compatibility with Microsoft C version 6.0. The _FAST macro is the recommended alternative.
__cplusplus__ Reserved by the Microsoft C/C++ version 7.0 compiler to assist in portability between ANSI C and C++.
_FAST Supersedes _QC, which is still supported but not recommended.

The /Ze command-line option, the default for Microsoft C, enables the Microsoft extensions. The /Za command-line option, compiling for ANSI compatibility, defines only the identifier form that has a leading underscore.¨