http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48376

Nicola Pero <nicola at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.04.08 09:28:42
                 CC|                            |nicola at gcc dot gnu.org
            Version|4.6.0                       |4.7.0
     Ever Confirmed|0                           |1

--- Comment #1 from Nicola Pero <nicola at gcc dot gnu.org> 2011-04-08 09:28:42 
UTC ---
Thanks for reporting this.

You are right that generating instance variables from properties is generally
missing; it requires non-fragile instance variables, which we will only have
(at least for the GNU runtime) in 4.7.

By the way, I believe the instance variable should actually be generated by the 
@synthesize - so, the example you want is probably

@interface Foo : Object
@property (retain) id bar;
@end

@implementation Foo
@synthesize bar;
@end

This also explains why non-fragile ivars are needed for this; the @interface
will be in headers, and visible to subclasses, while the @synthesize (which
actually adds the instance variable) will be in the implementation .m files
and won't be visible to subclasses.  So, subclasses will no longer see the
full list of instance variables of the superclass; this only works if you have
non-fragile instance variables, where the offset is calculated at runtime;
if you access instance variables directly, by calculating the offset at
compile time, you need the full list of instance variables to calculate the
offset.

So, before we can implement this, we have to implement non-fragile instance
variables. ;-)

Btw, the @property declaration itself wouldn't generate the instance variable,
because you can still have a @property with no corresponding instance variable,
for example if you declare your own setter/getter that may store the property
value somewhere else (or maybe have a constant property ?).  You wouldn't
want an instance variable automatically generated in that case.

Thanks

Reply via email to