Reputation: 11053
it is quite useful to comment in/out lines using a macro for debug mode.
Unfortunately the normal approaches don't work on the Mac Xcode.
I tried / ## /
as well as using a two step macro like
#define COMMENT SLASH(/)
#define SLASH(s) /##s
which I also found in the web.
But neither works.
Do you have an idea which way to define a comment macro. Thanks!
Upvotes: 0
Views: 636
Reputation: 11
Same Problem here...
The answer seems to be that we expect a traditional while XCode uses a ISO-conform preprocessor (see http://developer.apple.com/library/mac/#documentation/DeveloperTools/gcc-4.2.1/cpp/Traditional-macros.html#Traditional-macros) There seems to be the possibility to change the options of the preprocessor, but who knows what you will break in the code from the apple SDKs.
I went through my code and changed my uses of such macros so that the macro is not followed by the code that should be hidden, but instead pass the code as parameter to the macro... This way the code remains readable (not clobbered with #ifdefs)... It only gets ugly if your debug-code contains ","
Upvotes: 1
Reputation: 1738
Why not this?
#ifdef DEBUG
// Do debug stuff here
NSAssert(...);
#endif
I am curious how / why you would use a comment macro.
Upvotes: 1