[Development] QUuid documentation
b.terrier at gmail.com
Tue Sep 13 12:42:15 CEST 2016
Le 10 sept. 2016 12:18 AM, "Edward Welbourne" <edward.welbourne at qt.io> a écrit :
> Benjamin Terrier:
> >> However, my knowledge is that whatever the method one use to generate
> >> your UUID, one can never guarantee its uniqueness. Meaning that the
> >> Qt documentation is falsely guarantying unique UUID and therefore
> >> should be changed.
> >> If anyone can confirm, I'll create a bug report.
> Thiago Macieira
> > Right, it's not guaranteed. It's just that the chance of collision is
> > virtually zero.
> ... and for sufficiently small values of "virtually zero", that's as
> close a guarantee as you'll get to anything, because no matter how well
> you think you can guarantee things, cosmic rays still sporadically flip
> bits in your memory.
> I read a most illuminating paper a few years back that looked at the
> reliability of tests of prime-ness for large numbers. There's a widely
> used approach that's cheap and theoretically not guaranteed but easy to
> apply to enough test-cases to reduce the likelihood of error to
> ignorably low. This was compared to the best known "provably correct"
> algorithm for determining primeness - which is significantly more
> computationally expensive. Due to the (ridiculously rare) flipping of
> bits by cosmic rays hitting the processor and memory, the latter was in
> fact *less* reliable than the former, because the former ran faster so
> incurred a smaller chance of errors due to stray rays.
> I don't think we should worry about documenting how not-quite-perfect
> our guarantee of UID uniqueness is in a case where - realistically -
> the difference from perfection is ignorable.
> Development mailing list
> Development at qt-project.org
I agree with both of you.
Still I'd like the documentation to be changed, mainly for 2 reasons.
1. For the sake of correctness.
The sentence "the UUID will be of cryptographic quality, which will
make the UUID unique" is false
on a logical/mathematical/algorithmical point of view.
And here the documentation is about what the code does, what the
implemented algorithm provides, and
it does not provide a 100% guaranteed unique UUID.
Starting to justify that the UUID should be documented as guaranteed
unique in this part of the documentation
is out of scope because you make assumptions on where and how the code
will be executed.
It would be way better to tell that cryptographic quality UUID are as
unique as any UUID can be and that
in most use cases its uniqueness can be safely implied (because
hardware is less reliable, etc.).
2. For the sake of educating people
When reading "the UUID will be of cryptographic quality, which will
make the UUID unique", people who do not
have advance knowledge on UUID and such could come to think that there
is a way to guarantee UUID uniqueness.
And I'm pretty sure you could end up with quotes of Qt documentation
to back up the claim that
"UUID can be unique if the RNG is of cryptographic quality".
More information about the Development