[Development] What's our policy on changing the result of qHash(T, 0) between major releases?
Thiago Macieira
thiago.macieira at intel.com
Mon Feb 5 23:42:37 CET 2024
On Monday, 5 February 2024 01:36:39 PST Marc Mutz via Development wrote:
> I've always understood it such that we as Qt must preserve the property
> that the hash for equal elements is equal within _one_ run of _one_
> process. This means you can use the hash in I/O in any way. That's why
> we have qt_hash, which you _can_ (and do) use in I/O (but is private
> API, AFAIK). I never thought that a hash seed of zero would change that,
> but of course users may have come to depend on this (Hyrum's Law), so a
> [ChangeLog] would be in order.
In commit e3f05981cbeb0b7721f960ef88effa77be2af5ce, I added this comment to
qHashBits:
// mix in the length as a secondary seed. For seed == 0, seed2 must be
// size, to match what we used to do prior to Qt 6.2.
Which is why I am asking now, because making this change would go against that
comment. But there was no discussion in the change about whether this was
correct or not. It seems I just write it like that.
However, that was qHashBits(). The change I'm talking about is
qHash(QLatin1StringView), specifically so it won't call qHashBits().
--
Thiago Macieira - thiago.macieira (AT) intel.com
Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5163 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20240205/8c529626/attachment-0001.bin>
More information about the Development
mailing list