• 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: 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.

  • Follow-Ups:
    • Re: Removing NSLog & NSAssert for deployment
      • From: Andreas Monitzer <email@hidden>
References: 
 >Re: Removing NSLog & NSAssert for deployment (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: [somewhat OT] portable C under OjbC
  • 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