Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode Warning: "/* within block comment"

Tags:

xcode

ios

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.

like image 335
Hasib. A. Samad Avatar asked Feb 08 '13 13:02

Hasib. A. Samad


2 Answers

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
like image 197
trojanfoe Avatar answered Sep 23 '22 22:09

trojanfoe


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!

like image 45
Hasib. A. Samad Avatar answered Sep 24 '22 22:09

Hasib. A. Samad