Re: snag of G_LIKELY()



Am Sam, 2002-11-23 um 13.41 schrieb Matthias Clasen:

[...]

> And still hope for the compiler to generate equivalent code ? I have to
> admit that I consider the warning on assignments to be of doubious
> value. People who cannot trust themself to differentiate = and == are
> probably better of to to use
> 
> #define EQUALS(a,b) ((a) == (b))
> 
> or even
> 
> #define g_return_if_not_equal(a,b) g_return_if_fail((a) == (b))

Hmm, I agree.  It's probably not worth the effort.

It's just that the empty if() branch has been added on purpose -- to
implement this warning feature.  Thus the use of G_LIKELY() removes a
feature from GLib and that's something one should be aware of, no matter
whether it's decided to be OK or not.

Personally, I don't actually care that much about this feature.

--Daniel





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