• 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: Basic Q: reading properties from nil
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Basic Q: reading properties from nil (From: Rick Mann <email@hidden>)
 >Re: Basic Q: reading properties from nil (From: Nick Zitzmann <email@hidden>)
 >Re: Basic Q: reading properties from nil (From: Rick Mann <email@hidden>)
 >Re: Basic Q: reading properties from nil (From: Greg Parker <email@hidden>)

  • Prev by Date: Re: Basic Q: reading properties from nil
  • Next by Date: Re: [NSImage] Bug in System Preferences? [solved]
  • Previous by thread: Re: Basic Q: reading properties from nil
  • Next by thread: Re: Basic Q: reading properties from nil
  • Index(es):
    • Date
    • Thread