On May 25, 2014, at 11:38 AM, Jens Alfke <j...@mooseyard.com> wrote:

> On May 24, 2014, at 11:34 PM, Charles Srstka <cocoa...@charlessoft.com> wrote:
> 
>> This isn't strictly true; when you are returning objects by reference, doing 
>> so inside the @autoreleasepool will cause a crash. For example:
> 
> That’s a different scenario than the one the OP was asking about; stuffing a 
> reference into the address pointed to by a parameter is not the same thing as 
> returning a value. (If only Obj-C had proper support for multiple return 
> values. That’s one of my favorite features of Go.)
> 
> I agree it’s sort of related, but let’s not overcomplicate things. We are 
> trying to help a newbie, not write a textbook that has to cover every 
> possible case.

I disagree; this scenario is pretty important to keep in mind, since any app of 
appreciable size is going to need to worry about error reporting, the Cocoa 
standard for doing so is to return an autoreleasing NSError by reference, and 
this sort of thing is *really* easy to get bitten by, and then not realize it 
for a long time afterwards.

Charles

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to