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 02:15:52 +0100
On Sat, 2002-11-23 at 01:56, Daniel Elstner wrote:
>
> As for g_return_if_fail() and friends, I find Owen's idea to be quite
> interesting. Since G_LIKELY() requires gcc >= 3.0 anyway this shouldn't
> be much of a problem, should it?
Ah, I didn't get Owen's idea at first reading (maybe because of the typo
_g_tmp_conditional vs. _g_conditional). So the idea is to have
#define g_return_if_fail(expr) G_STMT_START{ \
if (G_UNLIKELY ( G_STMT_START{ \
gint value; \
if (expr) \
value = 1; \
else \
value = 0; \
value; \
}G_STMT_END ) \
{ \
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]