Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Runtime Differences

In general the behavior of properties is identical on all runtimes. There is one key difference, modern (64-bit) runtimes supports non-fragile instance variables whereas the legacy runtime does not.

Using the legacy (32-bit) runtime, you must fully declare instance variables in the @interface declaration block of a class since all clients of the class including—of course—subclasses must know the full storage details of the class. Since the storage definition of a class cannot change without incurring binary compatibility issues, synthesis of instance variables in the legacy runtime is not supported. For @synthesize to work in the legacy runtime, you must either provide an instance variable with the same name and compatible type of the property or specify another existing instance variable in the @synthesize statement.

For example:

@interface My32BitClass : NSObject
{
    CGFloat gratuitousFloat;
}
@property CGFloat gratuitousFloat;
@end
 
@implementation My32BitClass
@synthesize gratuitousFloat; // uses the instance variable "gratuitousFloat" for storage
@end
 
 
@interface My64BitClass : NSObject
{ }
@property CGFloat gratuitousFloat;
@end
 
@implementation My64BitClass
@synthesize gratuitousFloat; // synthesizes the instance variable "gratuitousFloat" for storage
@end


< Previous PageNext Page > Hide TOC


Last updated: 2008-02-05




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice