Re: turning g_assert* into warnings
- From: "Kalle Vahlman" <kalle vahlman gmail com>
- To: "Gtk+ Developers" <gtk-devel-list gnome org>
- Subject: Re: turning g_assert* into warnings
- Date: Fri, 12 Oct 2007 18:23:24 +0300
2007/10/12, Tim Janik <timj imendio com>:
> hey All.
> i'd like to propose to turn g_assert and friends like g_assert_not_reached
> into warnings instead of errors. i'll give a bit of background before the
> details though.
While the reasoning to make programs seem less crashy sounds
compelling, isn't this just admitting that developers are misusing the
g_assert* macros and Glib will bow down and disable functionality due
The macros are very clearly stated as fatal to the application in the
documentation, so they should be used very carefully and only when
*any* part of the program cannot function properly due to that
condition being false.
If an application is terminating while it still has a chance to save
data, I'd say it is a bug in the application. It should either
automatically do so before quitting or advice the user to perform
those two tasks to prevent data loss.
And libraries naturally should IMO _never_ use g_assert* in the first
place, since libraries should never be in charge of application
lifetime no matter how bad their internal state is.
So I'd vote no for circumventing API misuse, no matter how wide it is.
Distributors could start disabling assertions in their builds if they
feel that it is compelling enough to warrant it, and as said,
development builds (ie. all "from the source" installations) should
always have clear indications of bugs.
The macros probably could use more clear usage suggestions in the
documentation though, mentioning the fact that using them in a library
is usually just unfriendly to application developers since it prevents
craceful termination even if it would be possible.
Kalle Vahlman, zuh iki fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi
] [Thread Prev