zoukankan      html  css  js  c++  java
  • C++中预定义的宏

    以下信息摘自与标准C++的文档中。

    如果把这些宏加在程序的日志中,它将为开发人员进行问题分析提供了很好的帮助。

    standard c++ 1998版
    The following macro names shall be 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 are 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, an 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 generated 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 its value is, are implementationdefined.
    __cplusplus The name __cplusplus is defined to the value 199711L when compiling a C++ translation unit.


    standard c++ 2011版
    1 The following macro names shall be defined by the implementation:
    __cplusplus
    The name __ cplusplus is defined to the value 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 months are 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, an implementation-defined valid date shall be supplied.
    __FILE__
    The presumed name of the current source file (a character string literal).
    __LINE__
    The presumed line number (within the current source file) of 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 is 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 are conditionally defined by the implementation:
    __STDC__
    Whether __STDC__ is predefined and if so, what its value is, are implementation-defined.
    __ STDC_MB_MIGHT_NEQ_WC__
    The integer constant 1, intended to indicate that, in the encoding for wchar_t, a member of the basic character set need not have a code value equal to its value when used as the lone character in an ordinary character literal.
    __STDC_VERSION__
    Whether __STDC_VERSION__ is predefined and if so, what its value is, are implementation-defined.
    __STDC_ISO_10646__
    An integer constant of the form yyyymmL (for example, 199712L). If this symbol is defined, then every character in the Unicode required set, when stored in an object of type wchar_t, has the same value as the short identifier of that character. The Unicode required set consists of all the characters that
    are 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 has the value integer constant 1, if and only if the implementation has strict pointer safety.
    __STDCPP_THREADS__
    Defined, and has the value integer constant 1, if and only if a program can have more than one thread of execution.

  • 相关阅读:
    ubuntu上搭建review board代码评审站点
    android5.1 for tq335x
    2015.04.11
    DECLARE_GLOBAL_DATA_PTR宏定义问题
    6410移植android4.4.2笔记(持续更新)
    ubuntu安装packet提示重复冲突问题
    android5.0 aosp编译记录(由于机器硬件原因,改为4.4.2编译通过)
    2015.01.16
    2015.01.14
    SDSM框架
  • 原文地址:https://www.cnblogs.com/babyha/p/5196140.html
Copyright © 2011-2022 走看看