当前位置:网站首页>Built-in macros in C language (define log macros)
Built-in macros in C language (define log macros)
2022-08-09 06:32:00 【qq_36412526】
When we write C language programs, we often use macro definitions. C language also has many built-in macros.
Powerful built-in macros:
Let's write a program that defines a log macro to get a feel for it.
#include #define LOG(s) do { \ printfspan>("%s %s [%s:%d] %s\n", __DATE__,__TIME__,__FILE__,__LINE__,s);\ }while(0)void f(){LOG("Enter f()...");LOG("Exit f()...");}int main(){LOG("Enter main()...");f();LOG("Exit main()...");return 0;}Run it to see the effect:
See it runAs a result, doesn't it feel very familiar? Isn't the compilation information of the compilers we use like this?When writing code in the future, it is very convenient to write log information or debug in this way.
边栏推荐
- 报错:FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS重大开销和将disab补充道
- io.lettuce.core.RedisCommandTimeoutException Command timed out
- Integer 线程安全的
- 简单使用Lambda表达式
- pdf加密、找回密码
- Teach you how to make the Tanabata meteor shower in C language - elegant and timeless (detailed tutorial)
- idea中PlantUML插件使用
- 线程池总结
- 代码目录结构
- 2022-08-08: Given an array arr, it represents the height of the missiles that will appear in order from morning to night.When the cannon shoots missiles, once the cannon is set to shoot at a certain h
猜你喜欢

Xilinx Zynq ZynqMP DNA

Import the pycharm environment package into another environment

Invalid argument(s) appears when redis runs lua script

A test engineer with an annual salary of 35W was laid off. Personal experience: advice that you have to listen to

vs番茄助手的方便功能和便捷快捷键介绍

Inception V3 闭眼检测

Error jinja2.exceptions.UndefinedError: 'form' is undefined

无重复的字符的最长子串

普罗米修斯原理及节点发布

网络学习总结
随机推荐
shardingsphere data sharding configuration item description and example
工控设备的系统如何进行加固
BeautifulSoup4的介绍与使用
字节跳动笔试题2020 (抖音电商)
Unity Gobang Game Design and Simple AI(3)
mysql 总结
简单使用Lambda表达式
Service
Gao Zelong, a famous digital collection expert and founder of the Digital Collection Conference, was interviewed by China Entrepreneur Magazine
Inception V3 闭眼检测
Can Jincang Database Set Transaction Automatic Commit?
C语言实现顺序栈和链队列
untiy countdown
crc计算
e-learning summary
详解C语言中的wait()函数和waitpid()函数
After the VB.net program is closed, the background is still connected to SQL
Use baidu EasyDL intelligent bin
Redis 2 - 高级
深度学习-神经网络原理2