Reputation: 35993
I am using Xcode 4 to update one of my apps that were previously developed with Xcode 3.
On one part of the code I had:
#define CREATE YES
and later...
#ifdef CREATE
// do stuff
#endif
on Xcode 3, this branch would be executed just if CREATE was yes but now in Xcode 4 it is being executed all the time.
As far as I see that Xcode 4 approach appears to be the most correct, as I am asking if the variable is defined, Xcode 3 worked somehow as I wanted.
So, now, how do I test for the boolean value of CREATE on Xcode 4?
something like:
#ifdef CREATE == YES
// DO STUFF
#endif
thanks.
Upvotes: 2
Views: 1986
Reputation: 14334
#define CREATE 1
#if CREATE
// do stuff
#else
//do other stuff
#endif
i think that's what you're looking for?
Upvotes: 4
Reputation: 11838
try using the #if directive instead of #ifdef
#define CREATE NO
#if CREATE
//This should not run.
#endif
Upvotes: 3