[Development] qHash / QHash changes

Mathias Hasselmann mathias at taschenorakel.de
Mon Mar 19 11:01:11 CET 2012


Am Montag, den 19.03.2012, 10:42 +0100 schrieb Thiago Macieira:
> On segunda-feira, 19 de março de 2012 10.04.28, Mathias Hasselmann wrote:
> > Am Montag, den 19.03.2012, 08:01 +0000 schrieb Giuseppe D'Angelo:
> > > 2) Document to end users that it cannot be assumed that qHash output or
> > > QHash iteration order are stable, so people must not rely on that.
> > 
> > Would that be sufficient to prevent 3rd-party code relying on stable
> > iteration order from breaking?
> 
> They shouldn't rely on that at all. The documentation of QHash says that it 
> produces an arbitrary but stable[1] order.
> 
> As for the QtDBus problem, I am really not aware of any place where I wrote 
> code that depended on a specific order. If that happened, it was an 
> unintentional mistake.
> 
> [1] note that the order is stable. Two hashing tables with the same elements 
> must produce the same order.

Yes, but the way I understood Giuseppe's mail, he is proposing to drop
that property. That's why I ask: I am relatively sure I never relied on
that stable ordering by purpose, but I wouldn't bet on never having
relied on that property by accident. Latest when re-factoring, e.g. when
changing from QMap to QHash, it is quite easy to accidentally introduce
code that relies on QHash having stable order.

Ciao,
Mathias




More information about the Development mailing list