Re: string pointer


 



On Mar 7, 2018, at 2:24 AM, Dave <dave@...> wrote:

I disagree that it's dangerous. It's the standard way code is written when a parameter is passed back by reference. How many times in Apple code do you see something like:

Just because you see it in “Apple Code” doesn’t mean its the best or safest way of doing something. Just look at the quality of code coming out of Apple these days, its awful, in fact just look at the mess that is called XCode! 

Without having used any apps you've written, I can't compare. And 'out' parameters are widely used in Cocoa programming, not just by Apple.

Autoreleasing bugs are really difficult to find which is why I avoid using AU like the plague! 

I honestly don't see anything dangerous about the code in question. And your "ticking time bomb" explanation makes no sense to me (and I've been using Cocoa since 2000.) There's no difference between an autoreleased pointer that you get as the return value of a function, vs. one that comes from an 'out' parameter like this.

—Jens

Join cocoa@apple-dev.groups.io to automatically receive all group messages.