This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: const and strict aliasing rules
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: jlkjr at bioleap dot com (John L. Kulp)
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 4 Dec 2006 18:59:18 -0500 (EST)
- Subject: Re: const and strict aliasing rules
> You can work around this by using union's of pointers of both non-const
> and const types, but the reinterpret_cast solution would be more attractive.
>
> Thoughts?
This has nothing to do with const vs non-const but rather
a<int> and a<const int> are two seperate types which are not related in any way.
The C++ standard defines these two types as seperate types and are not compatiable
in any way for aliasing.
-- Pinski