On Sun, 20 Apr 2014 13:53:33 +0200
Alexander Huemer <alexander.hue...@xx.vu> wrote:

> > […]
> > -#define LEN(a)     (sizeof(a) / sizeof(a[0]))
> > +#define LEN(a)     (sizeof(a) / sizeof(a)[0])
> > […]
> 
> Why parenthesis anyway? a[0] is an expression, not a type, and there is 
> nothing to group here. sizeof is not a function!

#define LEN(a)     (sizeof a / sizeof *a)

is the right way to do it.
The length of an array is the size of the array divided by the length
of each element's type.
However, I don't see any error in the way it was done before noname
suggested changing it. 

Cheers

FRIGN

-- 
FRIGN <d...@frign.de>

Reply via email to