Re: Xcode 3.2.3: cannot pair a synthesized setter/getter with a user defined setter/getter
Re: Xcode 3.2.3: cannot pair a synthesized setter/getter with a user defined setter/getter
- Subject: Re: Xcode 3.2.3: cannot pair a synthesized setter/getter with a user defined setter/getter
- From: Clark Cox <email@hidden>
- Date: Fri, 18 Jun 2010 15:38:06 -0700
On Fri, Jun 18, 2010 at 12:47 PM, Christiaan Hofman <email@hidden> wrote:
>
> On Jun 18, 2010, at 21:02, Bill Bumgarner wrote:
>
>>
>> On Jun 18, 2010, at 10:50 AM, Gerd Knops wrote:
>>
>>> I have decided that this warning is counter-productive. When I implement a setter, clang shouldn't care.
>>>
>>> As is, when I implement a setter I have to remember to change the property declaration. And worse, if I decide I no longer need the setter, I have to remember to change the property declaration again, or risk hard to diagnose threading problems.
>>>
>>> So I want to disable that warning, but can't seem to figure out how. I tried
>>>
>>> -Wno-warn-atomic-property-rule
>>>
>>> but that just gives me "warning: unknown warning option" for each file...
>>>
>>> Any ideas?
>>
>> Yes; listen to the compiler and don't try to turn off the warning. It is behaving correctly and identifying a very real issue in your code.
>>
>> If you declare an @property that is atomic -- the default -- you must either use @dynamic, let the compiler @synthesize everything or provide an implementation of both the setter and getter.
>>
>> If you want to mix a manual implementation of, say, the setter with an @synthesize, declare the @property to be `nonatomic`.
>>
>> This behavior exists because it is impossible for you to declare something to be atomic and then provide only half of the implementation.
>>
>> b.bum
>
> BTW, does anyone know why atomic is the default? IME almost all properties I have don't need to be atomic, and the few that need to be actually require a custom implementation anyway. So in fact making them atomic is a huge performance hit for no reason whatsoever, i.e. very bad.
Are you sure that there's a "huge performance hit"? Have you actually
measured it?
For most types, on the Mac, the overhead of making the access atomic
is virtually zero (and in some cases actually *is* zero).
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden