• 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: KVO autonotifying complaining about custom setter return value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVO autonotifying complaining about custom setter return value


  • Subject: Re: KVO autonotifying complaining about custom setter return value
  • From: mmalc crawford <email@hidden>
  • Date: Wed, 5 Mar 2008 15:06:01 -0800


On Mar 5, 2008, at 2:56 PM, Bill Garrison wrote:

Note that this implies that the accessor methods are atomic. It's comparatively rare (unless you're using GC) that Cocoa developers implement atomic accessor methods, so you'd typically specify:

@property (nonatomic, setter=mySetMethod:,getter=myMethod) id valueTest;

So for most non-GC code, properties should be specified using @property (nonatomic, ...)?
I've seen a lot of Apple sample code that doesn't. Should we be filing docs/sample code bugs, or just enabling GC?


If the documentation/sample code is not for GC and does not specify nonatomic and there is a provided implementation that is not atomic, then yes you should file a bug.

A couple of examples to illustrate: If the sample defines

@property (copy) NSString *string;

then

@synthesize string;

that's fine.


If it defines:

@property (copy) NSMutableString *string;

then

@synthesize string;

- (void)setString:(NSString *)newString {
    if (string != newString) {
        [string release];
        string = [newString mutableCopy];
    }
}

that would not be OK (the declaration should include nonatomic).

mmalc


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >KVO autonotifying complaining about custom setter return value (From: "Jim Turner" <email@hidden>)
 >Re: KVO autonotifying complaining about custom setter return value (From: "Kyle Sluder" <email@hidden>)
 >Re: KVO autonotifying complaining about custom setter return value (From: Chris Suter <email@hidden>)
 >Re: KVO autonotifying complaining about custom setter return value (From: "Jim Turner" <email@hidden>)
 >Re: KVO autonotifying complaining about custom setter return value (From: mmalc crawford <email@hidden>)
 >Re: KVO autonotifying complaining about custom setter return value (From: "Jim Turner" <email@hidden>)
 >Re: KVO autonotifying complaining about custom setter return value (From: Adam P Jenkins <email@hidden>)
 >Re: KVO autonotifying complaining about custom setter return value (From: mmalc crawford <email@hidden>)
 >Re: KVO autonotifying complaining about custom setter return value (From: Bill Garrison <email@hidden>)

  • Prev by Date: Get Value for kCFPreferencesCurrentHost
  • Next by Date: Re: KVO autonotifying complaining about custom setter return value
  • Previous by thread: Re: KVO autonotifying complaining about custom setter return value
  • Next by thread: Re: KVO autonotifying complaining about custom setter return value
  • Index(es):
    • Date
    • Thread