C/C++的一些预定义宏
来源:互联网 发布:淘宝账号查询网址 编辑:程序博客网 时间:2024/05/18 02:25
__FILE__:当前源代码文件名的字符串文字
__LINE__:当前源代码中的行号的整数常量
__DATE__:进行预处理的日期(“Mmm dd yyyy”形式的字符串文字)
__TIME__:源文件编译时间,格式微“hh:mm:ss”
__func__:当前所在函数名,在C++中为__FUNCTION__
C++的测试代码如下(g++),其中VC中不支持__func__ :
1: #include
2: using namespace std;
3:
4: #ifndef __func__
5: #define __func__ (__FUNCTION__)
6: #endif
7:
8: void func()
9: {
10: cout<<"func name is:"<<__func__<<endl;
11: cout<<"func name is:"<<__FUNCTION__<<endl;
12: }
13:
14: int main()
15: {
16: cout<<"date is :"<<__DATE__<<endl;
17: cout<<"time is :"<<__TIME__<<endl;
18: cout<<"file is :"<<__FILE__<<endl;
19: cout<<"line is :"<<__LINE__<<endl;
20:
21: func();
22: }
http://blog.csdn.net/hzpeterchen/article/details/5461212
2. __ARMEB__:
if defined big endian, it's defined by the compiler when it is invoked with -EB (for big-endian).
http://linux.chinaunix.net/techdoc/develop/2006/10/08/941673.shtml
gcc的-D和-U参数:宏的设置与取消
http://bbs.chinaunix.net/thread-3660159-1-1.html
gcc 等C语言的编译器默认加载的宏定义
用 gcc -dM -E - < /dev/null 可以获得一份列表。
- C/C++的一些预定义宏
- C/C++的一些预定义宏
- C/C++的一些预定义宏
- C 语言标准中一些预定义的宏
- C标准中一些预定义的宏
- C标准中一些预定义的宏
- C标准中一些预定义的宏
- C标准中一些预定义的宏
- C标准中的一些预定义的宏
- C标准中一些预定义的宏
- C标准中的一些预定义宏
- C标准中的一些预定义宏
- C标准中的一些预定义宏
- C中的一些预定义宏
- C 预定义的宏
- C/C++/ARMC中的一些预定义宏
- C预定义宏
- C 预定义宏
- javascript详解02
- Android颜色值XML文件
- 使用semaphore实现生产者-消费者简单模型
- unit eghit
- .net 源代码度量指标
- C/C++的一些预定义宏
- unit nine
- zoj 2892
- ExtJS编码规范
- unit ten
- android自动更新程序
- Resin问题
- 三大WEB服务器对比分析(一)
- .net等比生成高质量缩略图