Pre-defined macros in C + +

Source: Internet
Author: User

The following information is excerpted from the documentation for standard C + +.

If these macros are added to the program's log, it will provide a good help for the developer in analyzing the problem.

standard C + + version 1998
The following macro names shall is defined by the implementation:
__line__ the line number of the current source line (a decimal constant).
__file__ the presumed name of the source FILE (a character string literal).
__date__ the DATE of translation of the source file (a character string literal of the form "MMM dd yyyy", where the names Of the months is the same as those generated by the Asctime function, and the first character of DD is a space character If the value is less than 10). If the date of translation is not available, a implementationdefined valid date is supplied.
__time__ the time of translation of the source file (a character string literal of the form "Hh:mm:ss" as in the time gene Rated by the Asctime function). If the time of translation is not available, an implementationdefined valid time is supplied.
__stdc__ Whether __stdc__ is predefined and if so, what's it value is, is implementationdefined.
__cplusplus The name __cplusplus is defined to the value 199711L when compiling a C + + translation unit.


standard C + + version 2011
1 The following macro names shall is defined by the implementation:
__cplusplus
The name __ Cplusplus is defined to the value of 201103L when compiling a C + + translation unit.
__date__
The date of translation of the source file:a character string literal of the form "MMM dd yyyy", where the names of the M Onths is the same as those generated by the Asctime function, and the first character of DD is a space character if the V Alue is less than 10. If the date of translation is not
Available, an implementation-defined valid date shall is supplied.
__file__
The presumed name of the current source file (a character string literal).
__line__
The presumed line number, within the current source file, is the current source line (an integer constant).
__stdc_hosted__
The integer constant 1 if the implementation is a hosted implementation or the integer constant 0 if it's not.
__time__
The time of translation of the source file:a character string literal of the form "Hh:mm:ss" as in the time generated by The Asctime function. If the time of translation is not available, an implementationdefined valid time shall be supplied.
2 The following macro names is conditionally defined by the implementation:
__stdc__
Whether __stdc__ is predefined and if so, what's it value is, is implementation-defined.
__ stdc_mb_might_neq_wc__
The integer constant 1, intended to indicate, and the encoding for wchar_t, a member of the basic character set need n OT has a code value equal to it value when used as the lone character in an ordinary character literal.
__stdc_version__
Whether __stdc_version__ is predefined and if so, what's it value is, is implementation-defined.
__stdc_iso_10646__
An integer constant of the form YYYYMML (for example, 199712L). If This symbol was defined, then every character in the Unicode required set, when stored in a object of type wchar_t, has The same value as the short identifier of this character. The Unicode required set consists of all the characters that
is defined by ISO/IEC 10646, along with all amendments and technical corrigenda as of the specified year and month.
__stdcpp_strict_pointer_safety__
Defined, and have the value integer constant 1, if and only if the implementation have strict pointer safety.
__stdcpp_threads__
Defined, and has the value integer constant 1, if and only if a program can having more than one thread of execution.

Pre-defined macros in C + +

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.