Re: retain/release question about Apple docs
Re: retain/release question about Apple docs
- Subject: Re: retain/release question about Apple docs
- From: Shaun Wexler <email@hidden>
- Date: Mon, 6 Mar 2006 12:33:33 -0800
On Mar 6, 2006, at 11:13 AM, Clark Cox wrote:
Even better would be:
#define REPLACE(a, b) do { if (b != a) {[b retain]; [a release]; a =
b; } } while(0)
Think about what happens if it is called like the following:
if(flag)
REPLACE(foo, bar);
else
REPLACE(foo, baz);
What, are we playing "one-up 'ya"?!! Okay:
#define REPLACE(a, b) do { register __typeof(a) _a_ = a; [b retain];
(a) = b; \
#if __ppc__ \
__asm__ volatile ("sync") \
#endif \
[_a_ release]; } while (0)
;)
--
Shaun Wexler
MacFOH
http://www.macfoh.com
Arguing with an engineer is like wrestling with a pig in mud.
After a while, you realize the pig is enjoying it.
_______________________________________________
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