This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g++ and aliasing bools


On Mon, 28 Jan 2002, Joe Buck wrote:

> Daniel writes:
> > *I* already argued that they aren't dangerous for another reason.  In C, 
> > since they would have the same address, they would alias.  In reality, 
> > in C++, they *don't* alias because they *don't* have the same address.  
> > However, it's perfectly fine to say things alias that don't.
> > Thus, it's not dangerous.
> 
> Excuse me, but the whole point of strict aliasing is that certain things
> are treated by the compiler based solely on their types, even if they have
> the same address (for such cases it is considered a user bug).  For example,
> an access to an int can never alias an access to a float, period.  If a
> user writes code that violates this rule, it is not valid ISO C or C++,
> and they need to write -fno-strict-aliasing if they want GCC to avoid
> "miscompiling".
> 
Right, but this is why i said they weren't dangerous for "another" 
reason.

--Dan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]