Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enabling NSZombieEnabled depending on build configuration.



AEC Software - Óscar Morales Vivó wrote on Friday, July 14, 2006:
>However I find it pretty annoying that it has to be set on the  
>executable at launch. It would be a lot less prone to trouble if it  
>could be set by build configuration (i.e. debug can have it on, while  
>it's off for the release build).

I usually do this by creating a pre-processor macro that indicates that I'm in "development."

Add a macro definition to either the "Preprocessor Macros" or "Preprocessor Macros Not Use in Precompiled Headers," as appropriate, of your project or target build settings but only for your "Debug" configuration:

    GCC_PREPROCESSOR_DEFINITIONS = IN_DEVELOPMENT=1

Then bracket all debug related support code with that.

    #ifndef IN_DEVELOPMENT
        #define IN_DEVELOPMENT 0    /* NO if not declared in the build settings */
    #endif
    
    ...
    
    int main( int argv, char** argc )
    {
        ...
        
    #if IN_DEVELOPMENT
        NSDebugEnabled = YES;
        NSZombieEnabled = YES;
        //NSDeallocateZombies = YES;
    #endif
    
        ...

This code only gets compiled when building my "Debug" configuration.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.