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.
C++中预定义的宏的更多相关文章
- visual c++中预定义的宏
一.主要目标 (由于visual studio通常包含很多开发环境,通常将其中c/c++的ide称为visual c++ 20xx) 整理下visual c++ 2010下预定义的宏.做一下备忘和了解 ...
- gcc中预定义的宏__GNUC__
转载:gcc中预定义的宏__GNUC__ - Cccarl - 博客园 (cnblogs.com) 今天在看Linux系统编程这本书的代码的时候看到了__GNUC__,不太清楚这个宏所以去查了一下,以 ...
- ARM编译器中预定义的宏
arm系列目前支持三大主流的工具链,realview的armcc,iar ewarm的iccarm,gnu的gcc,编译器在编译的时候会预定义一些宏,这些宏在工程中起到不可或缺的作用. 例如 /* d ...
- C标准中一些预定义的宏
C标准中指定了一些预定义的宏,对于编程经常会用到.下面这个表中就是一些常常用到的预定义宏. 宏(双下滑线) 意义 __DATE__ 进行预处理的日期(“Mmm dd yyyy”形式的字符串文字) __ ...
- C标准中一些预定义的宏,如__FILE__,__func__等
C标准中一些预定义的宏 C标准中指定了一些预定义的宏,对于编程经常会用到.下面这个表中就是一些常常用到的预定义宏. 宏 意义 __DATE__ 进行预处理的日期(“Mmm dd yyyy”形式的字符串 ...
- VS2013 预定义的宏
Visual Studio 2013 预定义的宏 https://msdn.microsoft.com/zh-cn/library/b0084kay(v=vs.120).aspx 列出预定义的 ANS ...
- 2019-8-31-dotnet-新项目格式与对应框架预定义的宏
title author date CreateTime categories dotnet 新项目格式与对应框架预定义的宏 lindexi 2019-08-31 16:55:58 +0800 201 ...
- dotnet 新项目格式与对应框架预定义的宏
在 sdk style 的项目格式支持使用多框架开发,此时需要在代码里面通过宏判断,在编译的时候执行不同的代码.本文告诉大家在框架里面对应的预定义的条件编译符有哪些 在让一个 csproj 项目指定多 ...
- 五个在XML文档中预定义好的实体
下面是五个在XML文档中预定义好的实体: < < 小于号 > > 大于号 & & 和 ' ' 单引号 " " 双引号 实体 ...
随机推荐
- 【转】Python爬虫(4)_selenium模块
一 介绍 selenium最初是一个自动化测试工具,而爬虫中使用它主要是为了解决requests无法直接执行JavaScript代码的问题 selenium本质是通过驱动浏览器,完全模拟浏览器的操作, ...
- Python基础(18)_面向对象程序设计2(反射、__str__、__del__、__item__系列)
一 isinstance(obj,cls)和issubclass(sub,super) isinstance(obj,cls)检查是否obj是否是类 cls 的对象 class Foo(object) ...
- 加载顺序 ready onload onreadystatechange
js文件是异步加载, js是在什么时候被加载执行的 动态引入的外部 JS 文件在各浏览器中的加载顺序不一致 1/ready,表示文档结构已经加载完成(不包含图片等非文字媒体文件):比如 ...
- GitHub命名规则
● Added ( 新加入的需求 ) ● Fixed ( 修复 bug ) ● Changed ( 完成的任务 ) ● Updated ( 完成的任务,或者由于第三方模块变化而做的变化 )
- 021_在Eclipse Indigo中安装插件hadoop-eclipse-plugin-1.2.1.jar,直接运行wordcount程序
1.工具介绍 Eclipse Idigo.JDK1.7-32bit.hadoop1.2.1.hadoop-eclipse-plugin-1.2.1.jar(自己网上下载) 2.插件安装步骤 1)将ha ...
- 【HackerRank】 有洞的地图
给你一个n*n的地图.地图中的每个格子有一个值表示该地区的深度.我们称一个地图中的一个格子为空洞,当且仅当该格子不在地图边缘并且每个和它相邻的格子都具有比它更小的深度.两个格子称为相邻如果它们共有一条 ...
- 20145240 《Java程序设计》第四周学习总结
20145240 <Java程序设计>第四周学习总结 教材学习内容总结 6.1继承 6.1.1 继承共同行为 定义:继承基本上就是避免多个类间重复定义共同行为. 优点:1.提高了代码的复用 ...
- 在Linux终端中查看公有IP的方法详解
首先回顾一下一般的查看IP的命令: ifconfigLinux查看IP地址的命令--ifconfigifconfig命令用于查看和更改网络接口的地址和参数 $ifconfig -a lo0: fla ...
- Python 循环语句(while, for)
# while的使用 # 要注意些循环的时候,要考虑好循环的结束 # 考虑循环结束的方法有2种: # 1.考虑在循环体里改变while 的条件 # 2.在循环体通过break 语句跳出循环 # 方法1 ...
- 【2039】checker(Dp)
我今天脑子貌似又好使了一点,可以做一做DP中的水题了. 这个题难度蓝色,纯属是做的人太少了虚高. 这个题很显然的是可以用一个顺序一个逆序这两个大水转移方程轻松转移出到达这个地方最少需要的棋子数量,然后 ...