|
Kalle, The problem is we now have a mixture of code using the g_return_* calls as they are meant to in public functions to validate input, but we also have g_return_* being used in static functions to validate some internal state. There's nothing wrong in a programmer validating the internal state of his library at any time, but he should be using g_assert to do so. If they don't use g_assert then we have to turn off all the checking in the library to get the performance gain, but now our external library calls don't have any parameter validation in them :( Kinda sucks - and yes you are entirely correct that we could just remove the g_return_* calls from all static functions, but I'd have thought converting them into g_asserts was probably more consistent with the original authors intention - though could be wrong of course :) JR Snip from Frederico: http://www.mail-archive.com/desktop-devel-list gnome org/msg02548.html http://developer.gnome.org/doc/guides/programming-guidelines/robust.html See the "Assertions and Preconditions" section on that page. Summary: use g_return_*() in library entry points to ensure that no garbage is fed into your library. Use g_assert() internally to ensure that you are in a consistent state. Kalle Vahlman wrote: 2005/10/17, John Rice <John Rice sun com>: |