This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How to type-pun and why
- From: Gabriel Dos Reis <gdr at cs dot tamu dot edu>
- To: Mattias Engdegård <mattias at virtutech dot se>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 12 Jun 2006 10:18:29 -0500
- Subject: Re: How to type-pun and why
- References: <e6jvfg$kmq$1@sea.gmane.org>
Mattias Engdegård <mattias@virtutech.se> writes:
| Using a union intermediate instead,
|
| union { double d; uint64_t x; } u;
| u.d = something;
| uint64_t x = u.x;
|
| works as expected, but I would like to know why - if it is a matter of luck
| with the current implementation it might cease working when the compiler
| changes or becomes more aggressive in the future.
that union trick is invalid as well, from the standard point of view.
However, GCC makes a guarantee that it will be supported.