Re: turning g_assert* into warnings

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.


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