在Objective-C中更改预处理器值 [英] Change Preprocessor value in Objective-C
本文介绍了在Objective-C中更改预处理器值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以通过以下方式更改预处理器值:
Is there any way to change a preprocessor value like:
#define XValue 50
在Objective-C中?
in Objective-C?
推荐答案
如果要在运行时更改它,则不会,因为在编译之前, XValue
被 50
替换。
If you mean changing it during runtime, then no, as XValue
is replaced with 50
before compilation.
如果要在编译中更改它,则可以,使用 #undef
和 #define
。
If you mean changing it in the compilation, then yes, using #undef
and #define
.
示例:
XValue = 30; // NOT ALLOWED
#undef XValue // ALLOWED
#define XValue 30
这篇关于在Objective-C中更改预处理器值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文