This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g++ and aliasing bools
- From: Joe Buck <jbuck at synopsys dot COM>
- To: mark at codesourcery dot com (Mark Mitchell)
- Cc: jbuck at synopsys dot COM (Joe Buck), dan at dberlin dot org (Daniel Berlin),neil at daikokuya dot demon dot co dot uk (Neil Booth),pcarlini at unitus dot it (Paolo Carlini), gcc at gcc dot gnu dot org (gcc at gcc dot gnu dot org)
- Date: Mon, 28 Jan 2002 17:11:02 -0800 (PST)
- Subject: Re: g++ and aliasing bools
> > The basic argument is this: I am allowed to implement C++ in a way that
> > zero-sized classes don't exist (they always come out as at least one
> > byte). For such implementations I can clearly use the C rules, as there
> > is an equivalent C program. If I then replace the inefficient
>
> [Implicitly, we're still in the simple_enough case here, i.e., no virtuals,
> etc. Perhaps the argument applies more generally, but we don't know yet.]
> OK, you've convinced me to extend simple_enough to the cases with
> zero-sized thingies, so long as the other conditions still hold.
We can handle inheritance as well if the zero-sized object is OK, since
the C translation is to make the base class look like a member of the
derived class. This will allow us to do better on most STL iterators;
many are derived classes but they have no virtual functions.