Re: turning g_assert* into warnings

> c) programs that aren't 100% bug free could possibly trigger these warnings
>     during production. aborting would take all the end user data with it,
>     created/modified images, text documents, etc.
>     issuing just a warnig preserves the possibility to still save crucial
>     data if the application logic state still permits (which is most often
>     the case in practice).
> in a recent discussion, i figured that (c) perfectly applies to g_assert
> and g_assert_if_reached() also. but we're actually aborting here:

One problem i see is that
g_return_if_fail() also does something, ie returns,
which can act as a sufficient fallback in many cases.

Another tradeoff is that while you may be able to save something,
it may be corrupted.  my recent work (on journalling databases)
has seen a lot of cases where assertions prevented corruption
from making it to disk, allowing an earlier state to be resumed.
but that may be less common on the desktop.

Finally, i do think it's a pretty big break with the traditional
definition of assert().

- dave

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