Re: retain/release question about Apple docs
Re: retain/release question about Apple docs
- Subject: Re: retain/release question about Apple docs
- From: Greg Titus <email@hidden>
- Date: Mon, 6 Mar 2006 09:04:48 -0800
Well, one thing wrong with it is that it doesn't actually do the
replacement if you try to set the value to nil.
- Greg
On Mar 6, 2006, at 8:52 AM, Julian Cain wrote:
What is wrong with using a macro such as :
#define REPLACE(a, b) if (b != nil) {[b retain]; [a release]; a = b;}
This is what I always use for setters.
~Julian Cain
email@hidden
On Mar 6, 2006, at 4:32 AM, Volker Runkel wrote:
Hi James,
the string newValue has to be released since it was retained
before creating a copy to mString .
The usual procedure would be :
if (mString != newValue) {
// don't retain here [newValue retain];
if (mString) [mString release];
mString = [newValue copy];
// so don't release here [newValue release];
}
Volker
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden