标签:next ict struct ica most hive array man aci
[objc explain]: Non-fragile ivars (2009-01-27 09:30 PM) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Non-fragile instance variables are a headline feature of the modern Objective-C runtime available on iPhone and 64-bit Mac. They provide framework developers more flexibility without losing binary compatibility, and pave the way for automatically-synthesized property ivars and ivars declared outside a class‘s interface. The fragile base class problemFragile ivars are a subset of the classic fragile base class problem. In some languages, a superclass cannot be changed without also recompiling all subclasses of that class. For example, adding data members or virtual member functions to a C++ superclass will break binary compatibility with any subclass of that class, even if the added members are private and invisible to the subclass. In classic Objective-C, methods are mostly non-fragile, thanks to dynamic message dispatch. You can freely add methods to a superclass, as long as you don‘t have name conflicts. But Objective-C ivars are fragile on 32-bit Mac. 32-bit Mac: fragile Objective-C ivarsSay you‘re writing the world‘s next great pet shop application for Mac OS X Leopard. You might have this
Then Mac OS X Def Leopard comes out, with its new multi-paw interface technology. The AppKit developers add some paw-tracking code to
Unfortunately, your kittens are doomed by fragile ivars. Alternatively, the AppKit developers are trapped with whatever ivars they chose in Mac OS X 10.0. iPhone and 64-bit Mac: non-fragile Objective-C ivarsWhat you and the AppKit developers really want is something like this.
Here, the runtime has recognized that How it worksThe generated code for classic Objective-C ivar access works like a C In the pet shop example, |
http://www.sealiesoftware.com/blog/archive/2009/01/27/objc_explain_Non-fragile_ivars.html
[objc explain]: Non-fragile ivars
标签:next ict struct ica most hive array man aci
原文地址:https://www.cnblogs.com/feng9exe/p/10276195.html