Conditional Compilation in Xcode

I would like to disable the compiler for a section of my code. I do not want to use comments to “hide” the code from the compiler, because this section contains a lot of comments /*...*/. I would suggest that there is a general way to use compiler directives or #defines or something to control compilation. In fact, my desire to suppress compilation does not depend on state such as SDK or platform, I just wanted to disable it. How to do it?

+3
source share
2 answers

A quick fix is ​​to wrap this section of code with

#if 0
#endif

where 0 means false. To turn it back on,

#if 1
#endif

- ( → → ) , , , . ,

#ifndef IGNORE_THIS_SECTION
#endif

" " #ifdef.

+6

Source: https://habr.com/ru/post/1787012/


All Articles