[glib] gtestutils: Clarify that g_assert() should not have side effects



commit 3f12ca57c453a9e757040b6a0fa816ac07c0d394
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Wed Nov 9 16:52:21 2016 +0000

    gtestutils: Clarify that g_assert() should not have side effects
    
    g_assert() gets completely compiled out if G_DISABLE_ASSERT is defined,
    so applications should not depend on side effects of the expression in
    an assertion.

 glib/gtestutils.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index 3275cda..d4b0fbe 100644
--- a/glib/gtestutils.c
+++ b/glib/gtestutils.c
@@ -380,7 +380,8 @@
  * an error message is logged and the application is terminated.
  *
  * The macro can be turned off in final releases of code by defining
- * `G_DISABLE_ASSERT` when compiling the application.
+ * `G_DISABLE_ASSERT` when compiling the application, so code must
+ * not depend on any side effects from @expr.
  */
 
 /**


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