This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Strict aliasing and converting binary patterns between integerand float
- From: Chris Lattner <sabre at nondot dot org>
- To: gcc at gcc dot gnu dot org
- Cc: Olivier Galibert <galibert at pobox dot com>
- Date: Sun, 31 Aug 2003 17:01:02 -0500 (CDT)
- Subject: RE: Strict aliasing and converting binary patterns between integerand float
> I need to convert back and forth between an unsigned int and the float
> with the same binary pattern (admitting I knows they're the same size -
> 32bits - in the first place).So my question is, what is a reliable way
> to do this conversion with gcc and strict aliasing enabled?
Use a union.
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/