On Sun, 13 Jun 2010, Gabor Kovesdan wrote:

+/*
+ * Utility macros.
+ */
+#define DPCPU_SUM(n, var, sum) \ +do { \
+       (sum) = 0;                                                      \
+       u_int i;                                                        \
+       CPU_FOREACH(i)                                                  \
+               (sum) += (DPCPU_ID_PTR(i, n))->var;                  \
+} while (0)

I'd suggest first swapping variable declaration and '(sum) = 0;'.
Also using 'i' as a counter in macro can easly lead to name collision.
If you need to do it, I'd suggest '_i' or something.
Maybe it would be better to make it an inline function rather than macro?

And why using old BSD-stlye u_int? style(9) also suggest using ISO C types.

That is for fixed-width types (uintN_t instead of u_intN_t).  KNF still uses
the abbreviation u_int for `unsigned' or worse `unsigned int', except where
namespace issues prevent use of u_nt.

Bruce
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to