Reputation: 33146
I frequently need multiple nested multiline (or "partial line") comments while developing.
Xcode recently introduced possibly the world's most annoying Warning - and it's forced me to disable "warnings as errors". I'm guessing this warning is to catch the extremely rare case of when someone typos and causes a block comment to have no end - but IME there are many many other problems that will cause that will reveal it very quickly.
Some examples:
/* removed while debugging the BARFOO
-(void) aMethod
{
[self methodCall:7.0 /* needed to FOO the BAR: */ * self.multiplier * /* double for hi-res:*/ 2.0];
}
*/
and:
/* removed while debugging the BARFOO
/** This method has DOCUMENTATION
*/
-(void) aDocumentedMethod
{
...
}
-(void) aMethod
{
/** internally, we have to BAR BAR the FOOFOO.
1. BAR
2. BARBAR
3. Finally, FOOOFOO
*/
...complex lines of source here...
}
*/
and of course, the very simple double-comment-out while debugging.
But I can't find a place in Xcode5 to disable this warning - it doesn't seem to exist in any of the listed warnings :( ?
Upvotes: 4
Views: 3381
Reputation: 437632
If you want to see the warning code, do a build, go to the "Log Navigator", select a build, expand the build log:
Once you're looking at the details of your build log, you'll see the warning code listed there. In this case, you'll see the warning is -Wcomment
.
Note, this helps you identify the warning you inquired about (the "/* within block comment" warning), but it doesn't change the behavior of nested /* ... */
comments.
I personally use Abizern's technique for quickly commenting large blocks. Alternatively, you could use
#if 0
and
#endif
(which you can nest) when commenting out your block
Upvotes: 3
Reputation: 150615
You could just use //
for comments everywhere. That way you don't get this warning.
/
is also compatible with doxygen type comments, you don't need to use the /**
version.
And Xcode supports this syntax. If you select a region you can toggle the comments with cmd + /
Upvotes: 2