• 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: How did gcc handle synthesized atomic vs custom nonatomic setter/getter?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How did gcc handle synthesized atomic vs custom nonatomic setter/getter?


  • Subject: Re: How did gcc handle synthesized atomic vs custom nonatomic setter/getter?
  • From: Bill Bumgarner <email@hidden>
  • Date: Sun, 10 Oct 2010 11:10:50 -0700

On Oct 10, 2010, at 10:20 AM, Bill Bumgarner wrote:

> On Oct 10, 2010, at 5:10 AM, Jerry Krinock wrote:
>
>> In deciding how to solve the problem, I'd like to know how gcc solved the problem!  It seems there are three choices:
>>
>> (1) Wrap my non-atomic custom setter/getter code to make it atomic.
>> (2) Change my declaration to make it nonatomic.
>> (3) Somehow ignore the rule and compile the code as I wrote it.
>>
>> Which did gcc do?
>
> GCC ignored the problem and happily generated code that wasn't atomic.

That is, GCC is broken.  LLVM is correct in indicating that your code is broken.

To fix, either let the compiler synthesize both getter and setter or implement both.

Note that 'atomic' has nothing to do with thread safety.  In almost all cases, declaring the @property as 'nonatomic' is the right answer (in that your thread safety -- if needed -- is at a higher level of then individual properties).

b.bum

_______________________________________________

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

  • Follow-Ups:
    • Re: How did gcc handle synthesized atomic vs custom nonatomic setter/getter?
      • From: Kyle Sluder <email@hidden>
References: 
 >How did gcc handle synthesized atomic vs custom nonatomic setter/getter? (From: Jerry Krinock <email@hidden>)
 >Re: How did gcc handle synthesized atomic vs custom nonatomic setter/getter? (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: How did gcc handle synthesized atomic vs custom nonatomic setter/getter?
  • Next by Date: Re: How did gcc handle synthesized atomic vs custom nonatomic setter/getter?
  • Previous by thread: Re: How did gcc handle synthesized atomic vs custom nonatomic setter/getter?
  • Next by thread: Re: How did gcc handle synthesized atomic vs custom nonatomic setter/getter?
  • Index(es):
    • Date
    • Thread