Re: turning g_assert* into warnings

Il giorno ven, 12/10/2007 alle 14.40 +0200, Mathias Hasselmann ha
> I was in strict "HELL, NO!" mode until I read this reasoning. Still I am
> not sure if G_DISABLE_ASSERT is a misfeature, since when using g_assert*
> instead of g_return* or g_warning you usually really have no good
> fallback strategy and therefore accept the program crashing.

I always considered G_DISABLE_ASSERT as the glib version of NDEBUG, useful only for performance reasons. So if you disable assertions you know that you could get a program crashing hours after the g_assert and without any useful debugging output.

> So I guess what you really want is some kind of "g_soft_assert" or
> some
> "g_warn_if_fail".

+1 on g_warn_if_fail()/g_warn_if_reached().

Marco Barisione

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