On Sun, Jul 01, 2007 at 12:11:38AM +0200, Peter Stuge wrote:
> On Fri, Jun 29, 2007 at 04:36:03PM +0200, [EMAIL PROTECTED] 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.
-- 
http://www.hermann-uwe.de  | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org

Attachment: signature.asc
Description: Digital signature

-- 
linuxbios mailing list
[email protected]
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to