soylent r62 - trunk/src



Author: treitter
Date: Fri Feb  1 17:28:46 2008
New Revision: 62
URL: http://svn.gnome.org/viewvc/soylent?rev=62&view=rev

Log:
add a note on ARRAY_LEN() usage (to hopefully avoid embarassing situations in the future)

Modified:
   trunk/src/soylent-utils.h

Modified: trunk/src/soylent-utils.h
==============================================================================
--- trunk/src/soylent-utils.h	(original)
+++ trunk/src/soylent-utils.h	Fri Feb  1 17:28:46 2008
@@ -30,6 +30,9 @@
 
 #define STRING_NULL_OR_EMPTY(x) ((!(x)) || (g_str_equal ((x), "")))
 
+/* XXX: always assign this to a variable and use that variable, to avoid
+ * unexpected signed-to-unsigned promotion of negative numbers (eg, a signed int
+ * of -1 gets promoted to 4294967295U on 32-bit arches). */
 #define ARRAY_LEN(x) ((sizeof (x)) / sizeof (x[0]))
 
 typedef struct widget_signal_args_tag widget_signal_args_t;



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