[PATCH libinput] evdev: replace null sentinel with ARRAY_SIZE

Jan Engelhardt jengelh at inai.de
Wed May 10 15:25:04 UTC 2017


On Wednesday 2017-05-10 17:20, Dima Ryazanov wrote:
>      +#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a)[0])
>
>
>I'm guessing this works, but "sizeof(a)[0]" looks very unintuitive to me. I think "sizeof(a[0])" is
>the convention?

If going with the sizeof(T) syntax, then the answer would 
be "sizeof((a)[0])", or alternatively, "sizeof(*(a))".


More information about the wayland-devel mailing list