On Dec 16, 2009, at 8:18 AM, Eric E. Dolecki wrote:

> NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
> 
> alarm1_hour = [prefs integerForKey:@"alarm1Hour"];
> 
> if( alarm1_hour == NULL ){
> 
>  NSLog(@"alarm 1 hour is null" );
> 
> }

-integerForKey returns a NSInteger. Comparing NSInteger to NULL (which is a 
declared as a pointer) is going to give you that warning. It certainly makes 
not sense to compare an integer to NULL.

> Should I use a temporary variable to check instead of the variable with the
> pointer? Or are these warnings okay to ignore?

Warnings are almost never ok to ignore. The compiler is trying to tell you that 
you're probably doing something wrong.

-- 
Dave Carrigan
[email protected]
Seattle, WA, USA

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to