Reputation: 1081
I really like to temporary enable and disable code parts by commenting them this way:
/*
some code
/**/
(Mind the
/**/
instead of
*/
at the end)
However, XCode keeps giving me the warning:
/* within block comment
Is there any way to "custom-disable" specific warnings?
WHY? I will tell you why: Because I can easily take it in and out with only one character, without having to scroll down the block to take the "*/ in and out.
Upvotes: 5
Views: 10021
Reputation: 2636
The real answer for me (just disabling an XCode warning, without changing any line in legacy code) is here: https://stackoverflow.com/a/21046102/540639
Apple LLVM 6.0 Custom Compiler Flags -> Other Warning Flags -> -Wno-comment
Upvotes: 5
Reputation: 1081
I found a very nice alternative to:
/*
some code
/**/
You can just use this variant:
/*
some code
//*/
to achieve the same goal without any Xcode warnings!
Upvotes: 6
Reputation: 122391
When I want to temporarily remove a block of code I use:
#if 0
somecode();
#endif
Which avoids this issue and is easy to spot later.
If I want to later temporarily re-enable that code, then I simply flip the 0
to 1
:
#if 1
somecode();
#endif
However if this enable/disable needs to be more visible, and easier to control, then I use a constant defined at the top of the source file instead:
#define SOME_FANCY_FEATURE 1
...
#if SOME_FANCY_FEATURE
somecode();
#endif // SOME_FANCY_FEATURE
Upvotes: 8