C++ Logo

std-proposals

Advanced search

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

From: Thiago Macieira <thiago_at_[hidden]>
Date: Thu, 23 Nov 2023 09:13:31 -0800
On Thursday, 23 November 2023 05:42:50 PST Frederick Virchanza Gotham via Std-
Proposals wrote:
> 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".

You're the first human being I've heard saying that (assuming you're not a
chatbot).

The default random number generator engines in the C++ standard output 31- or
32-bit random numbers. std::random_device in the three main implementations
outputs 32 bits too.

But you haven't explained why it should be 122 bits and then one must
subdivide it if they want smaller randoms, instead of composing 128 bits from
smaller units.

> > 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__.

You can produce reproducible and non-random outputs with __COUNTER__. There
are pitfalls across TUs, but each TU is reproducible on its own.

I'm asking about why you want two builds of the same source, back to back with
no changes at all, should be different.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-11-23 17:13:33