预处理符号

来源:互联网 发布:甘肃电信网络电视频道 编辑:程序博客网 时间:2024/04/27 22:12

 

/////////////////////////////////////////////////////////////////////////////////////////////
//by :  chlaws 
//point on c 
//14_2.cpp
//  符号         含义
//__FILE__     进行编译的源文件名
//__LINE__     文件当前有的行号(注意:是"当前")
//__DATE__     文件被编译的日期
//__TIME__     文件被编译的时间
//__STDC__     __STDC__用于那些在ANSI环境和非ANSI环境都必须进行编译的程序中结合条件编译
//             如果编译器遵循ANSI C,其值就为1,否则未定义
/////////////////////////////////////////////////////////////////////////////////////////////
#include<stdio.h>
#ifndef __STDC__ 
#define __STDC__   1
#endif
int main()
{
    printf(
"hello world ");
    printf(
" file name: %s  lines : %d ",__FILE__,__LINE__);
    printf(
" now date : %s  now time: %s ",__DATE__,__TIME__);
    printf(
" STAC is : %d ",__STDC__);    
    
if(__STDC__ != 1) printf("  __STDC__ is undefie ");
    
return 0;
}