[Bug libstdc++/8670] Alignment problem in std::basic_string

ncm-nospam at cantrip dot org gcc-bugzilla@gcc.gnu.org
Sun Jan 23 03:52:00 GMT 2005


------- 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



More information about the Gcc-bugs mailing list