|
Boost Users : |
Subject: Re: [Boost-users] Seeding boost::mt19937 with bytes from CryptoGenRandom
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2010-02-11 16:17:31
On Thu, Feb 11, 2010 at 7:39 PM, Steven Watanabe <watanabesj_at_[hidden]>wrote:
>
> The usual aliasing rules apply with only one exception (listed in 9.5):
>
> [Note: one special guarantee is made in order to
> simplify the use of unions: If a POD-union contains several POD-structs
> that share a common initial
> sequence (9.2), and if an object of this POD-union type contains one of the
> POD-structs, it is permitted to
> inspect the common initial sequence of any of POD-struct members; see 9.2.
> ]
Yes I read the paragraph as well. But as far as I understand my use case is
legal (assumed uint64_t is POD), which I think it is. Or am I mistaken?
This is what 9.2 Clause 16 states (you have a snippet from 9.5 which just
refers to that one):
"If a POD-union contains two or more POD-structs that share a common initial
sequence, and if the PODunion
object currently contains one of these POD-structs, it is permitted to
inspect the common initial part
of any of them. Two POD-structs share a common initial sequence if
corresponding members have layoutcompatible
types (and, for bit-fields, the same widths) for a sequence of one or more
initial members."
I understand that that it is allowed to use union for byte conversions of
POD types.
Regards,
Ovanes
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