Re: Seeing nil passed to isEqual:, despite non-null declaration
Re: Seeing nil passed to isEqual:, despite non-null declaration
- Subject: Re: Seeing nil passed to isEqual:, despite non-null declaration
- From: Quincey Morris <email@hidden>
- Date: Fri, 13 Jan 2017 10:34:00 -0800
- Feedback-id: 167118m:167118agrif8a:167118s1GNnEpG6_:SMTPCORP
On Jan 13, 2017, at 09:46 , Sean McBride <email@hidden> wrote:
>
> NSObject.h declares:
>
> - (BOOL)isEqual:(id)object;
>
> Note the parameter is not nullable.
Did I miss a change in clang that made the default “not nullable”?? I read the above declaration as meaning that the nullability is *unspecified*, which implies that nil is allowed.
It’s also instructive to read the formal definitions of the attributes:
http://clang.llvm.org/docs/AttributeReference.html#null-unspecified <http://clang.llvm.org/docs/AttributeReference.html#null-unspecified>
which says that nullability might be unspecified in cases where it cannot properly be determined. Note also that there are different attributes for saying that passing nil is illegal, and passing nil is undefined behavior.
As far as I’m aware, it’s always been possible to pass nil as the parameter to “isEqual:”. For that reason, the unannotated method declaration can’t imply a nullability attribute now, other than “unspecified”, because that would break reams of existing code.
_______________________________________________
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