• 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: Bill Cheeseman <email@hidden>
  • Date: Thu, 07 Feb 2002 16:56:18 -0500

on 02-02-07 3:53 PM, Jim Correia at email@hidden wrote:

> For assertions, the answer is to define NS_BLOCK_ASSERTIONS:
>
> <http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/Programming
> Topics/
> 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)?

This went right over my head. Can you elucidate?

1. As to NSAssert: WHERE and HOW do I define NS_BLOCK_ASSERTIONS? That is,
is it defined automatically by Project Builder when I choose the Deployment
build style, or one of the optimization levels? Or should I define it myself
in the build settings for the deployment target? Or do I have to define it
in each code file? And is defining it enough to magically suppress NSAssert
calls in my deployment build, or must I also wrap all my NSAssert calls in
#if defined(NS_BLOCK_ASSERTIONS) ... #endif? Or #ifdef NS_BLOCK_ASSERTIONS
... #endif?

The Programming Topic says this: "Assertions are not compiled into code if
the preprocessor macro NS_BLOCK_ASSERTIONS is defined." Taking this
literally, it means I don't have to use #if ... #endif in my code, but only
to define the macro. But I've learned to be wary of taking Apple help files
literally. And still, it says nothing about where and how to define the
macro.

I need a short walk through an example, here.

2. As to NSLog, where can I read about "variadic macros"? Which /Developer
docs are you talking about?

--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com

The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont - http://members.valley.net/croquetvermont
_______________________________________________
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: Paul Ferguson <email@hidden>
    • Re: Removing NSLog & NSAssert for deployment
      • From: Jim Correia <email@hidden>
    • Re: Removing NSLog & NSAssert for deployment
      • From: James Montgomerie <email@hidden>
References: 
 >Re: Removing NSLog & NSAssert for deployment (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: Removing NSLog & NSAssert for deployment
  • 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