let g_warn_if_fail replace g_assert



hey All.

proposing to turn g_asert into a warning:
  http://mail.gnome.org/archives/gtk-devel-list/2007-October/msg00053.html
was obviously not perceived too well.

as i read it, most people are not against my basic
reasoning, but are clearly in favour of adding
g_warn_if_fail or a similar variant thereof.

so i'd like to change course and suggest we do this:

- add g_warn_if_fail (condition); which produces a critical
  warning about failing assertions but contrary to g_assert
  returns.

- extend the g_assert() docs to note that:
  1) programmers are more likely to want to use g_warn_if_fail instead
     (particularly for libraries, allthough the destabilizing effects
     of g_assert are also worth avoiding in applicaiton code);
  2) for code portions that positively have to rely on program
     termination, only g_error() will deterministically achive that.

- proceed analogously for g_warn_if_reached() and g_assert_not_reached().

comments apprechiated, particularly on the new function names.

---
ciaoTJ


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