Re: turning g_assert* into warnings
- From: "Morten Welinder" <mwelinder gmail com>
- To: "Tim Janik" <timj imendio com>
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: turning g_assert* into warnings
- Date: Fri, 12 Oct 2007 09:24:25 -0400
That's pretty much a no-go.
g_assert_warning is marked G_GNUC_NORETURN.
If you return from such a function, there is no telling what incorrect
assumption the
following code was compiled with, i.e., things that the compiler thought were in
registers all of a sudden are not. Crash. Burn. Toast.
If you remove G_GNUC_NORETURN, you are going to get an unpleasant number
of "might/is used uninitialized" warnings. And if you do return, you
get the same
problems with bad assumptions as above, only this time in the client program.
All of this leads to the conclusion that g_asserts should be used
sparingly, i.e.,
for things where the program is in a really bad shape and has no idea about
how to limp on.
Morten
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]