Boost logo

Boost :

From: Marcus Lindblom (macke_at_[hidden])
Date: 2006-10-05 11:58:57

Frank Birbacher wrote:
> Hi!
> 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
> whatever).
How does the standard say on the suggestion of using &x instead of this?
Would that be allowed?
> 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, gregod at, cpdaniel at, john at