Re: getting the "=" vs. "==" warning from glib in g_return_if_fail



On Mon, 11 Feb 2002, Darin Adler wrote:

> >> Daniel Elstner <daniel elstner gmx net> writes:
> >>>   g_return_if_fail (widget_segment->type = &gtk_text_child_type);
>
> > Am Sam, 2002-02-09 um 21.28 schrieb Havoc Pennington:
> >> Yes, please go ahead. (I guess gcc didn't warn about that because the
> >> return_if_fail macro adds parens?)
>
> On 2/9/02 1:17 PM, "Daniel Elstner" <daniel elstner gmx net> wrote:
> > Yes, because it negates the expression:
> >
> >   if (!(expr)) ...
> >
> > However, one could replace it by
> >
> >   if (expr) {} else ...
>
> So is it OK to make this change in <glib/gmessages.h> for g_assert,
> g_return_if_fail, and g_return_val_if_fail? I'd really like to see it. Owen?
> Tim? If you give the OK, I'll commit the change.

Are you sure you want to do this in the first place?  If errors are turned
off (G_DISABLE_CHECKS), the assignment won't happen.  I don't know know
where this particular code is from, but the assignment might be required.

David
(who recently got stung by a g_assert(g_source_remove(watch))) when
G_DISABLE_CHECKS was undefined)


-- 
      __          _    __ David Helder - dhelder umich edu
  ___/ /__ __  __(_)__/ / <http://www.eecs.umich.edu/~dhelder>
 / _  / _ `/ |/ / / _  /  Jungle Monkey: <http://www.junglemonkey.net>
 |_,_/|_,_/|___/_/|_,_/   Paper CD Case: <http://www.papercdcase.com>




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