• 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: real noob question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: real noob question


  • Subject: Re: real noob question
  • From: Kyle Sluder <email@hidden>
  • Date: Mon, 19 Jan 2009 23:41:59 -0500

On Sat, Jan 17, 2009 at 11:41 PM, Richard Dammkoehler <email@hidden> wrote:
> NSDecimalNumber *num = [[NSDecimalNumber alloc] initWithString:"23.30"];

1) That's not an ObjC string, it's a C string.  That will crash unless
you replace it with @"23.30".
2) If the current locale isn't one that uses a period as the decimal
separator, that is not a valid number.
3) You are invoking the parser to convert hard-coded digits into an
NSDecimalNumber instance.  Why not just provide the number directly,
avoiding the parser altogether?  It's a constant, there's no need to
make the framework do more interpretation on it than necessary.

--Kyle Sluder
_______________________________________________

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: 
 >real noob question (From: Darren Stuart <email@hidden>)
 >Re: real noob question (From: Richard Dammkoehler <email@hidden>)

  • Prev by Date: NSData release seg fault. Whoops.
  • Next by Date: Re: NSData release seg fault. Whoops.
  • Previous by thread: Re: real noob question
  • Next by thread: NSTableColumn not usable with binder of class NSTextValueBinder
  • Index(es):
    • Date
    • Thread