Boost logo

Boost :

Subject: Re: [boost] [UUID] Code for UUIDs as PODs and other changes
From: Vladimir Batov (batov_at_[hidden])
Date: 2008-12-06 21:12:29

> >> uuid u = { /* 6ba7b814-9dad-11d1-80b4-00c04fd430c8 */
> >> 0x6b, 0xa7, 0xb8, 0x14,
> >> 0x9d, 0xad,
> >> 0x11, 0xd1,
> >> 0x80, 0xb4,
> >> 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8
> >> };
> >
> > I am not sure as a user I'd be interested in doing that kind of low-level stuff and in fact I am doubtful it'll even compile.
> >
> It does work, actually. I use it to implement
> uuids::namespaces::dns() and friends.

It compiles indeed! Tried MSVC++9 and even ol' gcc 3.4.4. C++0X talks about initialization of that kind but for standard containers. To me it feels like very non-standard behavior. What am I missing? Someone help me out here.

> 4.1.7. Nil UUID
> The nil UUID is special form of UUID that is specified to have all
> 128 bits set to zero.
> I'm not particularly attached to nil(), but at the same time, I don't
> have any better name. I dislike null(), when people are used to
> treating NULL as pointer (even when it actually isn't). C# uses
> Empty, but that's also not great, since empty is strongly entrenched
> through its use in the Container concept.

Fair enough. The standard expicitly mentioning uuid::nil() sounds like a good reason.

> Really, I'd be plenty happy to get rid of it entirely, since value
> initialization provides the same functionality: uuid id = uuid();

Have to disagree as to me the above is unclear as I am not sure if it means "create a new uuid" or "create an invalid uuid". I prefer saying clearly what I mean, i.e. uuid id(uuid::nil());


Boost list run by bdawes at, gregod at, cpdaniel at, john at