Requirement: the qHash function in question is and has always been out-of-
line. We obviously can't change the hashing function of inline code, because 
it may have been inlined.

When the seed is non-zero, we make no guarantees on what the result will be. 
The result is allowed to change between Qt versions and between machines, even 
for the same seed. Strictly speaking, you're not supposed to pass replay a 
seed, because some hash functions have a hidden seed you can't get or set.

But what about a zero seed? It's what we call a "deterministic hashing". We 
have changed the algorithms on .0 releases (in both 5.0 and 6.0 for QString).

The reason I'm asking is that right now

        qHash(QLatin1StringView(str)) == qHash(QByteArrayView(str))

but it would be far more useful to have

        qHash(QLatin1StringView(str)) == qHash(QString(str))

I've made the change for the non-zero seeds, but one couldn't rely on the 
above unless it applied for every seed.f

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering

Attachment: smime.p7s
Description: S/MIME cryptographic signature

-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to