RE: retain/release question about Apple docs
RE: retain/release question about Apple docs
- Subject: RE: retain/release question about Apple docs
- From: Jeff Laing <email@hidden>
- Date: Tue, 7 Mar 2006 12:04:27 +1100
> Yes, you are quite correct; but it's even simpler that that:
>
> #define REPLACE(a, b) \
> do { register __typeof(a) _a_ = (a); _a_ = [(b) retain]; \
> #if __ppc__ \
> __asm__ volatile ("sync") \
> #endif \
> [_a_ release]; } while (0)
Please excuse the naive question, but why is this better?
You *know* that the type of a is something that must be compatible with 'id'
or you couldn't send it retain. Why use the obscuring __typeof() stuff
especially since it masked a bug by being wordy.
(I can't see 'a' actually being altered by the above)
_______________________________________________
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