Boost logo

Boost Users :

Subject: Re: [Boost-users] [Review] UUID library (mini-)review starts today, November 23rd
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2008-12-02 00:00:32


On Mon, Dec 1, 2008 at 21:05, Christian Holmquist <c.holmquist_at_[hidden]> wrote:
>
> is_null()
> What does this mean?
> Ah, ok, from the docs I see it's a magic uuid (all zero) that is_null. Maybe
> is_zero() would be more clear?
>

I also prefer using zero in the name. That said,
http://www.faqs.org/rfcs/rfc4122.html calls it the "nil" UUID. But
.NET calls it Guid.Empty, and python seems to only call it
uuid.UUID(), so nil may not be any clearer.

Though really, why not just call it operator unspecified_bool_type?

assert(!int() && !shared_ptr<T>() && !uuid());

>
> static uuid create(uuid const& namespace_uuid, char const* name, int
> name_length);
> Can this be a generator instead?
>
> std::string name="www.widgets.com";
> name_based_generator gen(name.begin(), name.end());
> uuid id = gen();
>

A generator seems logical. I certainly don't like the char*+length version.

std::string name="www.widgets.com";
sha1_name_based_generator gen(dns_namespace_uuid);
uuid id = gen(name);
uuid id2 = gen(name.begin(), name.end());
assert(id == id2)

I'd rather know whether it was v3 or v5 somewhere more obvious than
the design notes, though. If I were using v3 (MD5) uuids and switched
to boost not knowing that v5 (SHA1) uuids exist, I'd likely be very
confused when my code stops working with my data.


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