WUtil: New macro 'wlengthof' in the public API to get number of elements in an array
commitfd47650717f4b4ab615d844ebc6b95a825cf30d7
authorChristophe CURIS <christophe.curis@free.fr>
Fri, 8 Nov 2013 20:18:19 +0000 (8 21:18 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Mon, 30 Dec 2013 18:11:03 +0000 (30 18:11 +0000)
treefabee0a2e1b24c3889e3423019ddab7b47aee59c
parentc3a132215dcf6565b5335bc27752648a3b8562e9
WUtil: New macro 'wlengthof' in the public API to get number of elements in an array

The new macro 'wlengthof' returns the number of elements for which a local
array have been defined, which makes code easier to read than the
previous [sizeof() / sizeof([0]) ] construct.

The macro includes a static assertion to stop compilation if it is being
used on a pointer, for which we cannot know the size of the array, to
avoid generating dummy result. This can work only with C11 which
standardised the static assertions.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
WINGs/WINGs/WUtil.h
configure.ac