Subject: [Boost-bugs] [Boost C++ Libraries] #4002: UUID documentation improvement
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-03-13 03:24:11
#4002: UUID documentation improvement
---------------------------------+------------------------------------------
Reporter: harris.pc@⦠| Owner: atompkins
Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: uuid
Version: Boost 1.42.0 | Severity: Optimization
Keywords: |
---------------------------------+------------------------------------------
I get "uninitialised value(s)" warnings in valgrind when I use the
following code:
boost::uuids::random_generator gen;
boost::uuids::uuid u = gen();
if (u == u) // for valgrind's benefit
whatever();
In the example, when I do not supply a random number generator to 'gen',
it calls:
detail::seed(*pURNG);
Which does not initialise all its state variables (like rd_[]) before
generating random numbers.
I assume this is done to try and generate decent random numbers from
uninitialised memory, especially when there is no /dev/urandom or similar
available. That is ok, I suppose.
However, it makes valgrind very noisy when comparing uuids and thus
generates a lot of false-positives to sift through.
It would be great if the documentation could talk a bit about this, and
also suggest that you use a pattern like the following if the library-user
wants to silence valgrind reports:
boost::mt19937 ran;
uuids::random_generator gen(ran);
It would be nice if it could also tell the library user why this might not
be such a good idea. (eg mt19937 doesn't seed the random values as
randomly as uuid's seed_rnd.hpp, right?).
Or perhaps you can surround the detail::seed() call with #ifdefs to allow
the user to control when uninitialised memory is used for seeding (helpful
to turn off when debugging).
Thanks,
Paul
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4002> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC