• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: retain/release question about Apple docs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >retain/release question about Apple docs (From: "James W. Walker" <email@hidden>)
 >Re: retain/release question about Apple docs (From: Volker Runkel <email@hidden>)
 >Re: retain/release question about Apple docs (From: Julian Cain <email@hidden>)
 >Re: retain/release question about Apple docs (From: Greg Titus <email@hidden>)
 >Re: retain/release question about Apple docs (From: Julian Cain <email@hidden>)
 >Re: retain/release question about Apple docs (From: "Clark Cox" <email@hidden>)

  • Prev by Date: SQLite vs. Apple's Cocoa SQLite
  • Next by Date: Mixing Cocoa and Cocoa-Java
  • Previous by thread: Re: retain/release question about Apple docs
  • Next by thread: Re: retain/release question about Apple docs
  • Index(es):
    • Date
    • Thread