This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __property keyword support in GCC
Joe Buck wrote:
> [ Re: implementation of Borland properties with a helper class ]
>
> > A sufficiently good compiler would optimize this kind of helper class
> > object away in any case (though we aren't there yet).
>
> Actually, in this case, there doesn't seem to be a way to get rid of
> the extra storage for the pointer, since this helper object would be
> a member.
Something involving `offsetof' comes to mind... Unfortunately GCC will
still not optimise the structure down to zero bytes.
> Not that this changes my mind, though, since I think it's better to
> show the actual calls to the member functions in the code rather than
> try to hide them.
There are some cases where the accessor function doesn't have any side
effects -- it simply does a computation or a type conversion using
another value.
In those cases, especially the type conversions, the caller really
doesn't need to know the underlying mechanism.
-- Jamie