[英]Using a macro in another macro and then undefining(#undef) the first macro c++
[英]Using/Copying the value of a macro variable in/to a macro function before undefining it: is it possible?
如果我有:
#define A 1
#define B() A
#undef A
這段代碼:
#if B()
std::cout << "B" << std::endl;
#else
std::cout << "not B" << std::endl;
#endif
將打印“不是B”。 有沒有一種方法可以將A分配給另一個宏變量/函數,然后清除掉A?
背景:在cmake的configure_file上下文中使用它 ,其中A
是使用#cmakedefine01
定義的。
沒有。
宏不是類,也不具有這種復雜性。
如果一個宏是用另一個宏定義的,則兩個宏都必須保留下來才能使替換正常工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.