• 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: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS


  • Subject: Re: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS
  • From: "email@hidden" <email@hidden>
  • Date: Mon, 13 Apr 2009 22:29:26 +0100


On 13 Apr 2009, at 22:13, Kyle Sluder wrote:

On Mon, Apr 13, 2009 at 4:47 PM, email@hidden
<email@hidden> wrote:
NSDecimalNumber *n2 = nil;
n1 = [n1 decimalNumberByAdding:n2];

You can't assume that nil is a valid argument. So no, the lack of any documentation stating that "passing nil will blow up" is not a bug.

Whatever way you slice it, bug or not, this is fairly toxic behaviour.

Checking the docs again I see that the previously listed method, - compare: does carry a caveat:

- (NSComparisonResult)compare:(NSNumber *)decimalNumber

Parameters
decimalNumber
The number with which to compare the receiver.

This value must not be nil. If this value is nil, the behavior is undefined and may change in future versions of Mac OS X.


--Kyle Sluder

Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.com




_______________________________________________

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


  • Follow-Ups:
    • Re: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS
      • From: Michael Ash <email@hidden>
    • Re: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS
      • From: Kyle Sluder <email@hidden>
References: 
 >NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS (From: "email@hidden" <email@hidden>)
 >Re: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Dynamically getting the type of ivars
  • Next by Date: Re: typeFromFileExtension in Leopard SDK
  • Previous by thread: Re: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS
  • Next by thread: Re: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS
  • Index(es):
    • Date
    • Thread