Are there macros or builtins that can return the length of arrays at compile time in GCC?
For example:
int array[10];
For which:
sizeof(array) == 40
???(array) == 10
Update0
I might just point out that doing this in C++ is trivial. One can build a template that returns the number inside []
. I was certain that I'd once found a lengthof
and dimof
macro/builtin in the Visual C++ compiler but cannot find it anymore.