Re: Property synthesis trouble - 32 vs 64 bit builds
Re: Property synthesis trouble - 32 vs 64 bit builds
- Subject: Re: Property synthesis trouble - 32 vs 64 bit builds
- From: Greg Parker <email@hidden>
- Date: Tue, 05 Jul 2016 12:55:20 -0700
> On Jul 5, 2016, at 9:27 AM, Jens Alfke <email@hidden> wrote:
>
>> On Jul 5, 2016, at 4:36 AM, Jonathan Taylor <email@hidden> wrote:
>>
>> It surprises me that I have to write different synthesis code for 32- or 64-bit builds
>
> It’s because they use different Obj-C runtimes. For compatibility reasons, 32-bit Mac apps still use the old runtime, while 64-bit apps (and all iOS apps) get to use the new improved runtime.
>
> One of the differences between the runtimes is how instance variables are accessed, and I think your particular situation — trying to synthesize a property backed by an _inherited_ ivar — is an edge case.
A synthesized property must use one of the following types of storage:
1. An ivar in that class that @synthesize creates.
2. An ivar in that class that you defined yourself.
@synthesize on 32-bit macOS doesn't support #1. The problem is that 32-bit macOS doesn't support non-fragile ivars. Allowing @synthesize to create ivars would make it too easy to accidentally change ivar layout and break compatibility.
No platform allows @synthesize to bind to a superclass ivar. That would make it too easy to accidentally bind to an unrelated superclass ivar when you really wanted to create a new ivar.
--
Greg Parker email@hidden <mailto:email@hidden> Runtime Wrangler
_______________________________________________
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