On Sun, Jul 01, 2007 at 12:11:38AM +0200, Peter Stuge wrote:
On Fri, Jun 29, 2007 at 04:36:03PM +0200, svn@openbios.org wrote:
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
Need extra () around a or no?
sizeof((a)) / sizeof(((a))[0])) ?
Hm, good question. I guess not, I've seen many projects use this macro without that many braces, but maybe they're all wrong ;-)
As long as 'a' is a simple array all should be fine, I guess. Using ARRAY_SIZE on something other than an array is probably a bug anyway.
Uwe.