Re: Strict aliasing plus placement new / explicit destructor call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Justin Lebar <justin.lebar@xxxxxxxxx> writes:

> I'm surprised that everyone here is in agreement that the code I
> posted obeys the strict aliasing rules.  My understanding -- and
> perhaps this is totally wrong -- is that the "may alias" relation
> isn't transitive.  That is, although char* may alias anything, T* may
> not alias char*.  Perhaps this explains the error I'm getting.

It's valid because the C++ aliasing rules are not the same as the C
aliasing rules.  In C++, if you use placement new, it changes the
dynamic type of the memory location.  The memory location must then be
accessed using that type, until a new placement new is run, or the
memory is modified using the original type.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux