[LinuxBIOS] [PATCH] v3: Add ARRAY_SIZE macro
Rudolf Marek
r.marek at assembler.cz
Fri Jun 29 15:36:08 CEST 2007
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/>
Rusty, that's a work of art.
However, I would suggest that you never show it to anybody ever again.
I'm sure that in fifty years, it will be worth much more. So please keep
it tightly under wraps, to keep people from gouging their eyes
out^W^W^W^W^W^W^W make a killing in the art market.
-- Linus Torvalds <http://lwn.net/Articles/226011/>
Maybe we will need something more insane too?
Rudolf
More information about the coreboot
mailing list