Re: Removing NSLog & NSAssert for deployment
Re: Removing NSLog & NSAssert for deployment
- Subject: Re: Removing NSLog & NSAssert for deployment
- From: Jim Correia <email@hidden>
- Date: Thu, 7 Feb 2002 15:53:17 -0500
On Thursday, February 7, 2002, at 03:19 PM, John C. Randolph wrote:
On Thursday, February 7, 2002, at 03:43 AM, Bill Cheeseman wrote:
Is it useful to remove NSLog and NSAssert macro calls when building an
Objective-C Cocoa application for deployment -- whether for performance
reasons or otherwise? If so, how is this normally done? Is there a
preprocessor macro for this?
I tend to just bracket NSAssert calls with #ifdef debug..#endif. (This
may not be the canonical way, though.)
For assertions, the answer is to define NS_BLOCK_ASSERTIONS:
<
http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ProgrammingTopics/
Assertions/Tasks/AssertMacros.html>
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)?
Jim
_______________________________________________
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.