Good point! I've only used it with arguments so far. Here is a better
version:
#ifdef __DEBUG_OUT__
#define DBOut(fmt, ...) fprintf(stderr, "%s\n", [[NSString
stringWithFormat:(fmt), ## __VA_ARGS__]
cStringUsingEncoding:NSUTF8StringEncoding])
#define DBCOut(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
#else
#define DBOut(fmt, ...)
#define DBCOut(fmt, ...)
#endif
On Apr 24, 2008, at 6:29 PM, Ken Thomases wrote:
There should be two hash characters ("##") before the __VA_ARGS__.
That's a gcc feature such that, if the macro is used without passing
arguments beyond the format string, then the comma is removed from
the expansion.
-Ken
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]