• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how to check if a property is empty?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to check if a property is empty?


  • Subject: Re: how to check if a property is empty?
  • From: Jens Alfke <email@hidden>
  • Date: Sat, 29 Mar 2008 10:16:31 -0700


On 29 Mar '08, at 8:32 AM, Davide Benini wrote:

		repetitions = [[NSNumber alloc] init];
		variantEnding = [[NSNumber alloc] init];

These lines don't really make sense. NSNumber (like its superclass NSValue) is immutable. You can't store a different number in one once you've created it. So there's no need to create one unless you have a specific number to store. Just don't set the variable at all, and its value will be nil. (That will let you know if you've set it, too.)


However, more typically you'd just use a regular C numeric type like 'int' or 'double' for a numeric property. That way you don't have to allocate or release the value, it uses less memory, and it's simpler to access the value.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >how to check if a property is empty? (From: Davide Benini <email@hidden>)

  • Prev by Date: Re: how to check if a property is empty?
  • Next by Date: Re: how to check if a property is empty?
  • Previous by thread: Re: how to check if a property is empty?
  • Next by thread: CAOpenGLLayer
  • Index(es):
    • Date
    • Thread