if defined
时间: 2024-01-27 18:03:07 浏览: 57
#if defined的作用是用来检查一个标识符是否已经被定义。如果标识符已经被定义,则执行#if后面的代码块。如果标识符没有被定义,则执行#else后面的代码块。\[1\]与#ifdef的区别在于,#ifdef只关心标识符是否被定义,而不关心定义的值是多少。而#if defined可以判断标识符是否被定义,并且可以根据定义的值来执行相应的代码块。\[2\]\[3\]
#### 引用[.reference_title]
- *1* [C语言的宏定义 #if defined 的作用](https://blog.csdn.net/xiaosshhaa/article/details/89476354)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [#ifdef #define #endif (避免头文件被重复包含的真正含义)](https://blog.csdn.net/weixin_40557160/article/details/129501369)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文