• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Removing NSLog & NSAssert for deployment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Removing NSLog & NSAssert for deployment
      • From: Bill Cheeseman <email@hidden>
    • Re: Removing NSLog & NSAssert for deployment
      • From: Finlay Dobbie <email@hidden>
References: 
 >Re: Removing NSLog & NSAssert for deployment (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Background Color opacity
  • Next by Date: Re: Removing NSLog & NSAssert for deployment
  • Previous by thread: Re: Removing NSLog & NSAssert for deployment
  • Next by thread: Re: Removing NSLog & NSAssert for deployment
  • Index(es):
    • Date
    • Thread