• 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: 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

  • Prev by Date: Re: [Q] Many array elements observing a few UI elements
  • Next by Date: Another Bindings problem - sorry!
  • Previous by thread: Re: retain/release question about Apple docs
  • Next by thread: Re: Issues with NSTextView and undoing attributes - Update
  • Index(es):
    • Date
    • Thread