[cfe-dev] Warnings when building with gcc-4.5

Christopher Jefferson chris at bubblescope.net
Wed May 12 10:40:19 PDT 2010


On 12 May 2010, at 18:37, Sebastien Binet wrote:

> Excerp
> speaking of GCC-4.5 warnings, I still get the strict-aliasing ones
> (yes, I saw the thread on the mailing list as well as the use of
> unions to prevent broken assembly generation)
> 
> in "my" codebase (one of the LHC experiments, so maybe not your
> typical state of the art source code), we usually get rid of those
> like so: 
> 
> template<typename DEST, typename SRC>
> DEST* hackish_cast(SRC* src)
> {
> // lame way of handling const-ness
> // a proper partial specialization would do just fine
> const void* cptr = src; 
> void* ptr = const_cast<void*>(cptr);
> return reinterpret_cast<DEST*>(ptr);
> }
> 
> would you consider applying a patch with such a modification ?

Are you sure the warnings are not being produced for a valid reason, and might lead to incorrect code?

Chris



More information about the cfe-dev mailing list