Re: GQUARK type and related calls.

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

 



On Tue, 2003-10-14 at 16:57, David Judkovics wrote:
> When 'g_quark_from_string ()' is first called it returns the value '1' 
> and subsequent calls with unique string values increment by '1' from there.
> 
> Return values for unique strings 1, 2, 3, 4, ....
> 
> I'd like to rely on this behaviour, starting value = 1 and incrementing 
> by 1,  for my particular application.
> 
> Is this behaviour documented?  Can I rely on it in future releases of glib?
> 

I would say it should not be. It makes code extremely fragile, as the
sequence is global. So relying on the sequence is relying on a global
variable in a very-shared base library being accessed by only your one
bit of code and no other.

It would even be legitimate for some other GLib function calls to use
GQuark in their implementation for example, so if you called any GLib
function other than the GQuark functions you'd have to assume the GQuark
sequence would change.

Seems very unrobust in the face of future code modifications. Why not
just make yourself a private array of strings and index into it?

Havoc

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux