g++ and aliasing bools
Daniel Berlin
dan@dberlin.org
Fri Jan 25 18:10:00 GMT 2002
On Friday, January 25, 2002, at 06:23 PM, Joe Buck wrote:
>> Mark Mitchell wrote:-
>>
>>> OK, I like this argument. *I* find it convincing, at least. :-)
>>
>> [...]
>>
>>> So, after the branch, let's have a patch to do this.
>>
>> Great; I think that Joe's "proof" should go in as a comment; both to
>> explain the ideas and subtleties behind the code, but also so we can
>> point at it and extract a similar argument from anyone who wants to
>> tighten the logic in future.
>
> The argument can be extended to handle non-virtual single or multiple
> inheritance: from the C point of view,
>
> struct D : public A, public B {
> int m;
> };
>
> can be thought of as
>
> struct D {
> struct A __base1;
> struct B __base2;
> int m;
> };
>
> and analyzed in the same way, meaning that D's alias set contains A, B,
> and m. But implementation-wise, that would mean that c_get_alias_set
> would have to be told to treat base classes as members.
But I wonder if it's worth it without going whole hog at that point (and
handling all cases properly). It stands to reason that the more
inheritance you have, the likelier you are to have some base class or
member not meeting the standard, causing us to give up, and mark the
whole thing as alias set 0.
I wonder how quick the gains diminish (IE how common it is to have
inheritance without the other features we don't support).
--Dan
>
>
>
>
More information about the Gcc
mailing list