[PATCH 0/4] BUG_RETURN_VAL macros
Peter Hutterer
peter.hutterer at who-t.net
Tue May 15 15:35:28 PDT 2012
On Tue, May 15, 2012 at 08:06:48PM +0200, Mark Kettenis wrote:
> > From: Peter Hutterer <peter.hutterer at who-t.net>
> > Date: Tue, 15 May 2012 20:26:37 +1000
> >
> > I got annoyed having to write constructs like
> >
> > BUG_WARN(foo);
> > if (foo)
> > return FALSE;
> >
> > and similar. glib has useful macros like g_return_if_fail and similar, these
> > are macros that essentially do the same job. They shout into the log, but
> > otherwise continue as normal.
> >
> > http://developer.gnome.org/glib/2.29/glib-Warnings-and-Assertions.html#g-return-if-fail
> >
> > These are not macros that should be used for handling normal out-of-scope
> > values, they're there to shout that there is a real bug that needs fixing.
>
> Still I think I agree with whoever said that hiding control flow
> instructions behind a macro isn't a good idea.
any good alternatives then? I've played around a bit trying to find
something that doesn't hide the return statement but it'd require more macro
trickery and generally worse code.
Cheers,
Peter
More information about the xorg-devel
mailing list