C语言-函数-Predefined preprocessor variables

本文深入探讨了预处理器宏如__LINE__, __FILE__, __DATE__, __TIME__, __cplusplus和__STDC__的作用与使用场景。这些变量能帮助开发者了解代码的编译时间和位置,对于调试和日志记录至关重要。

Syntax:

  __LINE__
  __FILE__
  __DATE__
  __TIME__
  __cplusplus
  __STDC__

The following variables can vary by compiler, but generally work:

  • The __LINE__ and __FILE__ variables represent the current line and current file being processed.
  • The __DATE__ variable contains the current date, in the form month/day/year. This is the date that the file was compiled, not necessarily the current date.
  • The __TIME__ variable represents the current time, in the form hour:minute:second. This is the time that the file was compiled, not necessarily the current time.
  • The __cplusplus variable is only defined when compiling a C++ program. In some older compilers, this is also called c_plusplus.
  • The __STDC__ variable is defined when compiling a C program, and may also be defined when compiling C++.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值