This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/8670] Alignment problem in std::basic_string
- From: "ncm-nospam at cantrip dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jan 2005 03:52:51 -0000
- Subject: [Bug libstdc++/8670] Alignment problem in std::basic_string
- References: <20021121063601.8670.jkanze@caicheuvreux.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From ncm-nospam at cantrip dot org 2005-01-23 03:52 -------
Somebody mentioned that using unions for type punning was described
in the textbooks as extremely bad form. That's how I always thought
of it, too, but it seems, at least in Gcc, unions are now the right
way to do type punning, instead of casting. For reference, see the
notes under "-fstrict-aliasing" (which is turned on by -O2) in
http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Optimize-Options.html
(Thanks to Robert Love for having pointed this out to me.)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8670