Re: snag of G_LIKELY()
- From: Matthias Clasen <maclas gmx de>
- To: gtk-devel-list gnome org
- Subject: Re: snag of G_LIKELY()
- Date: 23 Nov 2002 00:01:28 +0100
On Fri, 2002-11-22 at 17:09, Daniel Elstner wrote:
> Also, there's no point in doing
>
> if (G_LIKELY (expr)) { } else
>
> anymore since the empty if() branch was only there to trigger the GCC
> warning in case of an assignment in the condition.
So should this be simplified to the following ?
#define G_LIKELY(expr) __builtin_expect (!(expr), 0)
#define G_UNLIKELY(expr) __builtin_expect (!(expr), 1)
#define g_return_if_fail(expr) G_STMT_START{ \
if (G_UNLIKELY (expr)) \ { \ \
g_log (G_LOG_DOMAIN, \
G_LOG_LEVEL_CRITICAL, \
"file %s: line %d (%s): assertion `%s' failed", \
__FILE__, \
__LINE__, \
__PRETTY_FUNCTION__, \
#expr); \
return; \
}; }G_STMT_END
Matthias
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]