* Rudolf Marek <[EMAIL PROTECTED]> [070629 15:36]:
> Hi,
> 
> Just a short comment:
> 
> -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])                    \
> +     + sizeof(typeof(int[1 - 2*!!__builtin_types_compatible_p(typeof(arr), \
> +              typeof(&arr[0]))]))*0)
> 
> -- Rusty Russell <http://lwn.net/Articles/226010/>
> 
> Maybe we will need something more insane too?
 
I suggest we rather expect people to know what they are doing. Feeding a
non-array into a macro ARRAY_SIZE is not completely unlikely to happen
but adding trickery like the above will not make us any friends among
those trying to understand the code. 

-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: [EMAIL PROTECTED]  • http://www.coresystems.de/

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

Reply via email to