|
Boost Users : |
Subject: Re: [Boost-users] [Off topic] Strict Aliasing white paper redux
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-01-03 11:01:08
At Mon, 03 Jan 2011 00:08:23 -0800,
Patrick Horgan wrote:
>
> I'm not so sure. This idiom has been around as long as unions were in
> C. Do you know of any compilers that don't support it? Of course
> memcpy or any other solution using character pointers would be
> supported, but compilers wouldn't generate efficient code for in this
> case a simple swap of 16 bit ints. Clearly the specs say that a union
> can only contain one object at a time. Hmmm. The C99 spec has a
> footnote to section 6.5.2.3/3 that seems to clearly say you can do
> this
The C99 spec is irrelevant to C++; it isn't even "included by
reference," as the C89 spec is.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net