Re: Removing NSLog & NSAssert for deployment
Re: Removing NSLog & NSAssert for deployment
- Subject: Re: Removing NSLog & NSAssert for deployment
- From: Finlay Dobbie <email@hidden>
- Date: Thu, 7 Feb 2002 21:39:47 +0000
On Thursday, February 7, 2002, at 08:53 PM, Jim Correia wrote:
For NSLog one should be able to define a macro DEBUGLOG which maps onto
NSLog in debug builds, and nothing in production builds. In practice,
after reading the docs in /Developer I can't make variadic macros
work. I could have also made an inline function that did nothing in
production builds, but it wasn't a priority at the time, so I stuck
with #if DEBUG NSLog #endif. Anyone know how to make variadic macros
work with 2.95.2 (the latest official developer tools release)?
You'll have to make a macro function, something along the lines of:
#define SHOW_DEBUG_STRINGS
#ifdef SHOW_DEBUG_STRINGS
#define DLOG(fmt, args...) NSLog(fmt, ## args)
#else
#define DLOG(fmt, args...)
#endif
Then you can use DLOG(@"foo"). Not sure if that exact code will work,
just typed it looking at how AppleSCCSerial implements it (since I'm
currently looking at the code, and of course it uses IOLog instead of
NSLog ;-)).
-- Finlay
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.