Re: Type checking

2010/3/18 Emmanuele Bassi <ebassi gmail com>:
> On Thu, 2010-03-18 at 09:03 +1100, Andrew Cowie wrote:
>> I've often wondered about it, because on the one hand we have
>>         void
>>         gtk_button_set_label (GtkButton   *button,
>>                             const gchar *label)
>>         {
>>           g_return_if_fail (GTK_IS_BUTTON (button));
>> in gtk/gtkbutton.c which after wading through several macros ends up as
>> a call to g_type_check_instance() in glib/gtype.c with some if/else
>> blocks around it.
> the G_TYPE_CHECK_INSTANCE_TYPE() macro won't be disabled - ever. the
> only way to disable that particular type check is to compile with
> -DG_DISABLE_CHECKS, which disables g_return_*() -- and you don't really
> want to do that.

That's actually "you can't really do that", disabling checks (or to be
exact, using --disable-debug) would be nice enough for eg. embedded
systems, but since applications (and libraries) tend to regularly feed
invalid arguments to libraries and trust the library to handle it all
you get from it is crashing applications. Even gio was broken wrt

It's kind of a sad situation. :(

Kalle Vahlman, zuh iki fi
Powered by
Interesting stuff at
See also

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