Re: g_assert vs. g_return_if_fail
- From: Martin Kalbfuß <ma kalbfuss web de>
- To: Behdad Esfahbod <behdad esfahbod gmail com>
- Cc: Gtk+ <gtk-list gnome org>
- Subject: Re: g_assert vs. g_return_if_fail
- Date: Thu, 21 Jan 2010 00:17:55 +0100
I understand when to use g_return_if_fail. But still not why. The
essential question is, why not to use g_assert in libraries. I haven't
understood the data loss problem. And is this the only reason?
Why should a caller of a library function be able to ignore a
programming error?
I'm implementing a storage for ALLEGRO_BITMAP types, used both
internally and as API for external code.
Am Mittwoch, den 20.01.2010, 16:58 -0500 schrieb Behdad Esfahbod:
> On 01/20/2010 05:40 PM, Martin Kalbfuß wrote:
> > But shouldn't the function return GError in such a case?
> >
> > g_return_if_fail is like retunring an error without the ability to
> > handle it. I'm still not sure when to use it.
>
>
> g_return_if_fail() should be used to catch programmer error ONLY. There is no
> point in returning a GError in such cases.
>
>
> behdad
>
>
> > I assume g_assert is only useful in programs and internal library
> > functions.
> >
> >
> > Am Donnerstag, den 21.01.2010, 00:41 +0300 schrieb LRN:
> >> nd, AFAIK, it also logs warnings.
> >
> > _______________________________________________
> > gtk-list mailing list
> > gtk-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-list
> >
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]