Re: reasonable way of avoiding using autorelase?
Re: reasonable way of avoiding using autorelase?
- Subject: Re: reasonable way of avoiding using autorelase?
- From: Marco Binder <email@hidden>
- Date: Fri, 28 Mar 2003 17:10:53 +0100
alternatively to autoreleasing, would having the object that asks for
and recieves this object reference, just not retain it, be a way of
doing it?
It would not. Actually, very often, you dont retain the returned value
if you are just going to use it briefly. Still, the returned object
will not be released, because with the [[xxx alloc] init] you created a
non-autoreleased object, that has a retain count of 1 from the
beginning on. Therefore, the method creating the return value MUST
autorelease it. The only other way to do it, is that you object that
calls this method EXPLICITLY RELEASES the returned object. But I really
consider this messy, since how would you ever know, what methods return
an autoreleased instance an which return an retained instance?!
Marco
--
|\ /| E-Mail: email@hidden WWW: www.marco-binder.de
| \/ | Telefon: 07531 / 94 19 94 Fax: 07531 / 94 19 92
| |ARCO Snail-Mail: Banater Str. 3 - 78467 Konstanz
BINDER _____________________________________________________
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.