Translations of this page?:

预定义变量

语法:

    __LINE__
    __FILE__
    __DATE__
    __TIME__
    __cplusplus
    __STDC__

以下预定义变量可能因编译器而异,一般的理解为:

  • __LINE____FILE__ 变量记录了编译器的当前处理行和当前处理文件。
  • __DATE__ 变量包含当前文件被编译的日期,格式为:月/日/年。
  • __TIME__ 变量包含当前文件被编译的时间,格式为:时:分:秒。
  • __cplusplus 变量只有在C++程序中才被定义;一些老编译器也可以为c_plusplus
  • __STDC__ 变量在编译C程序的时候被定义,许多编译器在编译C++代码时也会定义此变量。

GCC特有变量

以下是GCC特有变量。While they are not specifically preprocessor macros they are magic and can be used the same way:

  • __func__ contains the bare name of the function
  • __FUNCTION__ is another name for __func__
  • The __PRETTY_FUNCTION__ contains the type signature of the function as well as its bare name.
 
• • • SitemapRecent changesRSScc