[Vala] _get_type() and G_GNUC_CONST



Hi all,

I've today compiled my program with recent valac (from git master), and
just from curiosity I've compared generated C sources with my previous
ones. Vala now makes all *get_type() functions const using G_GNUC_CONST.
I don't know at which version was this feature added (previously I used
0.9.2), but I've found some potential trouble with this.

In glib doc for G_GNUC_CONST macro: "A const function doesn't examine
any values except its parameters, and has no effects except its return
value."

In 10-years-old mail:
http://mail.gnome.org/archives/gtk-devel-list/2001-May/msg00174.html

"_get_type() functions do have side effects, that of registering
a type upon first invocation."

So... as far as I can remember get_type() functions still has effect of
registering a type in the type system upon first call? So is
G_GNUC_CONST in vala-generated code valid?

best regards,

-- 
Mój klucz publiczny o identyfikatorze 1024D/E12C5A4C znajduje się na
serwerze hkp://keys.gnupg.net

My public key with signature 1024D/E12C5A4C is on the server
hkp://keys.gnupg.net

Attachment: signature.asc
Description: PGP signature



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