On Mon, Apr 13, 2009 at 5:29 PM, [email protected]
<[email protected]> wrote:
>
> On 13 Apr 2009, at 22:13, Kyle Sluder wrote:
>
>> On Mon, Apr 13, 2009 at 4:47 PM, [email protected]
>> <[email protected]> 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.

Call it what you like, but it's also extremely common behavior. A
crash due to passing a NULL pointer to where it is not explicitly
allowed is extremely common in C, and Objective-C is just an offshoot
of C. Your attitude should not be that you will only avoid passing nil
to methods which say it's not allowed. On the contrary: unless nil is
*explicitly* allowed, you *must not* pass it. The fact that some
methods explicitly disallow it does not change this fact.

Mike
_______________________________________________

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