__cplusplus 如果源代码是cpp,则__cplusplus定义为1,如果源代码是c,则__cplusplus就是未定义.
举例:
CPP文件中使用到了C文件实现的函数,为了避免连接错误,需要使用extern “C”声明。
#ifdef __cplusplus
extern "C"
{
#endif
void myprintf(int a);
#ifdef __cplusplus
}
#endif
__DATE__ 11个字符的字符串表示程序编译的日期,例如:"May 3 2002".
__TIME__ 7个字符的字符串表示程序编译的时间,例如:"18:10:34".
__FILE__ 被编译的文件名
__func__ 当前函数名.
__LINE__ 当前在第几行
#define msg(str) \
fprintf(stderr,"File: %s Line: %d Function: %s\n%s\n", \
__FILE__,__LINE__,__func__,str);