Re: Shouldn't g_quark_from_static_string be const?





A thing to think about here, is that G_GNUC_CONST also means
side-effect-free, while g_quark_from_static_string() does have
a side effect - it creates the quark.

So,
g_quark_from_static_string ("foo");
g_quark_try_string ("foo");

Will change in behavior since GCC will optimize out the first call;
this came up some when we added G_GNUC_CONST to the get_type() functions.
Uhm... what a pitty. It can't even be declared as G_GNUC_PURE then... =/

Anyway "g_quark_try_string" can clearly be declared as G_GNUC_PURE.





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