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: NSLog and deployment builds



On 31.01.2005, at 20:35, Julian Vrieslander wrote:

I put the following in my <AppName>_Prefix.pch file:

#define ZNLog if([[NSUserDefaults standardUserDefaults]
boolForKey:@"WriteDebugInfo"])NSLog

This is a one line macro (remove the break if it wrapped).  I have
statements like the following in my code

ZNLog(@"The value of foo is: %@", foo);

You need to be really careful with "if" in a macro. Code such as

if (someCondition)
	ZNLog(whatever);
else
	ZNLog(somethingelse);

will not have the expected result because the else-clause will not be executed when someCondition is not true (as expected) but only if someCondition is true and the Key is not set.

Greetings,
Dix

_______________________________________________
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
References: 
 >Re: NSLog and deployment builds (From: Julian Vrieslander <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.