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.

  • 相关阅读:
    luogu P1840 Color the Axis_NOI导刊2011提高(05)|并查集
    luogu P5414 [YNOI2019]排序 |动态规划
    luogu P4064 [JXOI2017]加法 |二分+堆
    luogu P4065 [JXOI2017]颜色 |随机化+前缀和
    luogu P2135 方块消除 |dp
    luogu P1650 田忌赛马 |贪心
    IM群聊消息究竟是存1份(即扩散读)还是存多份(即扩散写)?
    IM群聊消息的已读回执功能该怎么实现?
    IPv6技术详解:基本概念、应用现状、技术实践(下篇)
    IPv6技术详解:基本概念、应用现状、技术实践(上篇)
  • 原文地址:https://www.cnblogs.com/babyha/p/5196140.html
Copyright © 2011-2022 走看看