g_assert() and consorts into {}?
- From: Tim Janik <Tim Janik Hamburg Netsurf DE>
 
- To: gtk-list redhat com
 
- Subject: g_assert() and consorts into {}?
 
- Date: Wed, 3 Dec 1997 14:37:09 +0100 (CET)
 
hi all,
i'd like to see all the macros around g_assert () (return_if_fail...),
to be enclosed by {}.
so that
#define g_assert(expr) \
     if (!(expr))                                    \
       g_error ("file %s: line %d (%s): \"%s\"",     \
                __FILE__,                            \
                __LINE__,                            \
                __PRETTY_FUNCTION__,                 \
                #expr)
will be defined as
#define g_assert(expr) \
{						     \
     if (!(expr))                                    \
       g_error ("file %s: line %d (%s): \"%s\"",     \
                __FILE__,                            \
                __LINE__,                            \
                __PRETTY_FUNCTION__,                 \
                #expr)				     \
}
this will avoid prblems with code snippets like
if (use_ballon)
  g_assert (ballon != NULL);
else
  g_assert (ball != NULL);
or
if (STRICT_CHECKS)
  g_assert (arglist > 0);
else
  g_return_if_fail (arglist > 0);
any objections?
---
ciaoTJ
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]