Macros and side-effects

I just had this small anoyance: when writing bindings from Gtk
to another language (Haskell, but it's not Gtk2hs, it's just
a personal use binding), I assigned constants to the value of
many macros in GObject Type Information section. Those would be

Those macros are actually constants, except for one: G_TYPE_GTYPE.
It calls a function, and since the assignment was done at compile
time, I didn't have g_type_init() called.

I don't know if this is important for other languages, as
side-effects need special care in Haskell. But is there some
general rule I could follow on that?


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