当前位置:网站首页>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.
边栏推荐
猜你喜欢

使用百度EasyDL实现智能垃圾箱

Invalid argument(s) appears when redis runs lua script

缓存技术使用

workbench 数据导出

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

05 多线程与高并发 - ThreadPoolExecutor 源码解析

Inception V3 闭眼检测

字节跳动面试题之镜像二叉树2020

运放-运算放大器经典应用电路大全-应用电路大全

Redis 2 - 高级
随机推荐
VB.net程序关闭后后台还在与SQL连接
APP product source data interface (taobao, jingdong/spelling/suning/trill platform details a lot data analysis interface) code and docking tutorial
leetcode 之 70 爬楼梯问题 (斐波那契数)
Introduction and use of BeautifulSoup4
mongo+ycsb性能测试及线程数分析
工控设备的系统如何进行加固
sql problem solving statement to create a table
变压器的工作原理(图解,原理图讲解,一看就懂)
uniapp实现防抖搜索
.NET高级技术
idea中PlantUML插件使用
Flask failed to create database without error
The solution that does not work and does not take effect after VScode installs ESlint
运放-运算放大器经典应用电路大全-应用电路大全
String.toLowerCase(Locale.ROOT)
The singleton pattern
网络学习总结
[GO], arrays and slices
使用百度EasyDL实现智能垃圾箱
golang xml 处理动态属性