From: Frank Birbacher (bloodymir.crap_at_[hidden])
Date: 2006-09-27 08:14:30
Martin Bonner schrieb:
>> Won't that not work in the presence of padding?
> In theory, yes. In practice, I can't see why any compiler would bother
> adding such padding.
> A more serious problem is if you start mixing usages. A compiler is
> quite likely to assume that assignments through the result of the index
> operator don't affect .y or .z, and optimize on that basis.
This is not a more serious problem in my opinion. The most serious
problem here is, that we are leaving the standard. It is open how the
compiler does the class layout and it is definitifely illegal to access
the class storage by converting "this" to an array of members. Apart
from padding the compiler may do other things which will for sure mess
up the array access (like reverse order of members, injecting additional
information into the class, "this" pointing to the end of storage
instead of the beginning, "this" being offset by a constant value, or
I'd appreciate if we could all have the discipline to follow the
standard. I'd like boost to continue being a portable C++ library. And I
guess libraries relying on such "hacks" will have a hard time being
accepted for boost.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk