Re: Basic Q: reading properties from nil
Re: Basic Q: reading properties from nil
- Subject: Re: Basic Q: reading properties from nil
- From: Rick Mann <email@hidden>
- Date: Tue, 26 Oct 2010 15:58:07 -0700
On Oct 26, 2010, at 15:47:09, Greg Parker wrote:
> On Oct 26, 2010, at 2:33 PM, Rick Mann wrote:
>> Sure seems like a conceptual inconsistency, but I guess whoever designed the language thought it was too expensive to return a zeroed struct.
>
> It's an artifact of C compatibility. On each architecture, Objective-C messages follow the same parameter-passing rules as C function calls. On all modern architectures, the rules for returning a struct mean that objc_msgSend() has no way to know how big the returned struct is supposed to be, so it can't zero it.
>
> A few years ago we prototyped a compiler that added the nil check at the call site instead. Doing that everywhere was too expensive in terms of code size, but doing it for structs only might be practical.
Fair 'nough. That makes sense.
--
Rick
_______________________________________________
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