Re: [gtk-list] Re: Are GHashTable's deterministic?



> I have reproduced the behavior with a very simple piece of code.
> You can have a look at the source code below.

yep:)

> I am certainly not requiring that the hash table be traversed in any
> specific order but I would like it to be traversed in the same order for
> two different runs of the "same" code: i.e. two versions of the same
> code, one of which only differ by some added code NOT CALLED but
> occupying some space in the process memory. My guess is that the memory
> occupied by the code modifies the way the hash table is generated and
> thus the order of traversal. I would like to know if this guess is
> correct or not.

Guess so, can't think of anything else for the moment. However, a hash
is not an ordered set of data, and so no ordering at all can be or should
be assumed about it. If you really want a order-preserving
hash-algortithm, make a hybrid of a GList and a GHashTable, where the
items you insert are the GList->data. This way, you can lookup
objects quickly using the hash, and traversing them using the GList.

Eivind

---

| Mail: eivindkv@ifi.uio.no               | Lazy on IRC
| HP: www.stud.ifi.uio.no/~eivindkv       | Experience is what causes
| Tlf: 22187263 / 95255807                | a person to make new mistakes
| Jobb: 23179507 / eivind@fondspartner.no | instead of old ones.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]