C语言几种 预定义宏
2011-08-12 11:41
148 查看
转自: http://blog.sina.com.cn/s/blog_50a0aa5e0100v0x7.html
c的几种可供C语言使用的预定义宏
MSDN 上的解释
__DATE__
The compilation date of the current source file. The date is a string literal 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.
__FILE__
The name of the current source file. __FILE__ expands to a string surrounded by double quotation marks. To ensure that the full path to the file is displayed, use /FC (Full Path of Source Code File in Diagnostics).
You can create your own wide string version of __FILE__ as follows:
Copy Code
#include <stdio.h>
#define WIDEN2(x) L ## x
#define WIDEN(x) WIDEN2(x)
#define __WFILE__ WIDEN(__FILE__)
wchar_t *pwsz = __WFILE__;
int main() {}
__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 compiler option is given and you are not compiling C++ code; otherwise is undefined.
__TIME__
The most recent compilation time of the current source file. The time is a string literal of the form hh:mm:ss.
__TIMESTAMP__
The date and time of the last modification of the current source file, expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy, where Ddd is the abbreviated day of the week and Date is an integer from 1 to 31.
以下是晚上找到的解释
__LINE__ 在源代码中插入当前源代码行号
__FILE__ 在源代码中插入当前源代码文件名
__DATE__ 在源代码中插入当前编译日期〔注意和当前系统日期区别开来〕
__TIME__ 在源代码中插入当前编译时间〔注意和当前系统时间区别开来〕
__STDC__ 当要求程序严格遵循ANSIC标准时该标识符被赋值为1。
c的几种可供C语言使用的预定义宏
MSDN 上的解释
__DATE__
The compilation date of the current source file. The date is a string literal 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.
__FILE__
The name of the current source file. __FILE__ expands to a string surrounded by double quotation marks. To ensure that the full path to the file is displayed, use /FC (Full Path of Source Code File in Diagnostics).
You can create your own wide string version of __FILE__ as follows:
Copy Code
#include <stdio.h>
#define WIDEN2(x) L ## x
#define WIDEN(x) WIDEN2(x)
#define __WFILE__ WIDEN(__FILE__)
wchar_t *pwsz = __WFILE__;
int main() {}
__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 compiler option is given and you are not compiling C++ code; otherwise is undefined.
__TIME__
The most recent compilation time of the current source file. The time is a string literal of the form hh:mm:ss.
__TIMESTAMP__
The date and time of the last modification of the current source file, expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy, where Ddd is the abbreviated day of the week and Date is an integer from 1 to 31.
以下是晚上找到的解释
__LINE__ 在源代码中插入当前源代码行号
__FILE__ 在源代码中插入当前源代码文件名
__DATE__ 在源代码中插入当前编译日期〔注意和当前系统日期区别开来〕
__TIME__ 在源代码中插入当前编译时间〔注意和当前系统时间区别开来〕
__STDC__ 当要求程序严格遵循ANSIC标准时该标识符被赋值为1。
相关文章推荐
- iOS Objecttive-C语言 定义常量的几种方式与区别 static const 定义常量 少用#define预处理指令 多用类型常量
- 黑马程序员-C语言的几种定义类型的总结
- C语言定义数组的几种形式
- C语言定义数组的几种形式
- C语言定义数组的几种形式
- C语言定义数组的几种形式
- C语言定义数组的几种形式
- C语言定义数组的几种形式
- 关于c语言中几种特殊预定义符号的使用
- C语言定义数组的几种形式
- C语言中字符串的几种定义方式
- C语言定义数组的几种形式
- C语言中定义结构体的几种方法
- C语言定义数组的几种形式
- C语言定义数组的几种形式
- C语言定义数组的几种形式
- C语言的几种排序方式
- 写接口请求类型为get或post的时,参数定义的几种方式,如何用注解(原创)--雷锋
- 定义并且立即执行JS匿名函数有几种方法~~转
- c语言中字符串常量定义时的换行问题