当前位置:网站首页>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.
边栏推荐
猜你喜欢
随机推荐
Search 1688 product interface by image (item_search_img-search 1688 product by image (Politao interface) code docking tutorial
Data center project preliminary summary
IQ Products CMV Brite Turbo试剂盒的原理
线程池总结
INSTALL_RPATH and BUILD_RPATH problem in CMake
中英文说明书丨TRC 交替醇(Catalogue NumberA575760)
变压器的工作原理(图解,原理图讲解,一看就懂)
Use baidu EasyDL intelligent bin
运算放大器(OPA)超详细参数讲解-运放---以及8个型号的运算放大器分析对比
crc calculation
常用Oracle命令
MongDb的查询方式
2022.8.8DAY628
无重复的字符的最长子串
什么是excel文件保护
缓存技术使用
力扣刷题180
线程的6种状态
Unity C# 委托——事件,Action,Func的作用和区别
Qt learning (3) - Qt module