#If directive striking out an inactive branch in Xcode

Is there any parameter for gray code that is inactive in the Xcode settings? The Eclipse IDE automatically allocates an inactive branch.

#if 1
    <code 1>
#else
    <code 2>
#endif

For the above code <code 2>should be grayed out, since it is inactive.

+4
source share
1 answer

Xcode does not have a built-in function. Perhaps you can write the Xcode plugin for this, but you will encounter the following problems.

  • The Xcode plugin API is neither supported nor documented.
  • Xcode plugins must be overwritten for new versions of Xcode
  • It’s actually difficult to determine if the code is active or not.

. ,

#ifndef SOME_UNUSED_DEFINE
    // Some code
#else
    // Some other code
#endif

else . , -DSOME_UNUSED_DEFINE, . ifndef , else .

+2

All Articles