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



This may not be the answer you're looking for, but if
you need to traverse the keys in a well-defined order,
_and_ still have (reasonably) fast key lookups, you might
want to use a GTree or one of it's variants.

Mark


Stiphane Popinet wrote:
> 
> Hi,
> 
> I'm using GHashTable's and I came accross a "curious" behavior. Changing
> the code size of my program (i.e. adding some functions) changed the
> behavior of the program (the new functions never being called). The
> first reaction is obviously to look for stack corruption and related
> symptoms. After a few hours (days?) of careful debuging, purifying and
> such, I realized that the difference in behavior was actually caused by
> a call to g_hash_table_foreach. What happened was that when the code
> size changed, the order in which items were stored in the GHashTable
> changed and g_hash_table_foreach did not step through items in the same
> order thus generating a different behavior.
>



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