Re: #define and if statements
Re: #define and if statements
- Subject: Re: #define and if statements
- From: Roland King <email@hidden>
- Date: Sat, 27 Feb 2010 14:25:41 +0800
Take the ';' off the end of the #define, the replaced text is everything to the end of the line, remember #define is just a text expansion, so with this
#define IsDemo NO;
replaced in this
if( IsDemo ) {
you're doing this
if( NO; ) {
and that's your syntax error
On 27-Feb-2010, at 2:22 PM, Adam Gerson wrote:
> I have the following constant set up. I have tried all three of these
> variations and none of them work in an if statement in cocoa. I get
> error: expected `)' before ';' token
>
> #define IsDemo NO;
> #define IsDemo false;
> #define IsDemo 0;
>
>
> if (IsDemo) {
> bla...
> }
>
> Same problem, when I try:
> #define FreeUpdateDaysAllowed 180;
> if (daysSoFar > FreeUpdateDaysAllowed)
>
>
> What am I doing wrong? Whats the right way to have a bool or int constant?
>
> Thanks,
> Adam
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden