C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Get UUID at compile-time from compiler (sort of like __COUNTER__)

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Thu, 23 Nov 2023 13:42:50 +0000
On Thu, Nov 23, 2023 at 1:29 AM Thiago Macieira wrote:
>
> Why 128-bit? Why not just restrict to 32- and 64-bit? If you need a 128 bits
> of randomness, just concatenate 2 or 4 of the lower-sized ones.


128 bits is the figure humans use nowadays when saying "I'm gonna make
a random number that the world has never seen before".


> > #define __UUID__ 0f234c3ac9ec4d7bab8e2fcac3da8a5c
> >
> > #define __UUIDstr__ "0f234c3ac9ec4d7bab8e2fcac3da8a5c"
>
> Just use macro/preprocessor stringification. There's no need for this one.


Yeah we could do:

    QUOTE( __UUID__ )

but the shorthand would be convenient and have less parentheses on the line.


> If you want to proceed with this, you may write a paper explaining the
> reasoning why a compilation should produce random output


I'll have a search through my own code, and through Boost, for uses of
__COUNTER__.

Received on 2023-11-23 13:43:03