On 10/18/10 04:53, Pádraig Brady wrote: > /* Like sizeof, except that it treats a variable sized array > as a pointer rather than determining the size at runtime. */ > #define CT_SIZEOF(x) (__builtin_constant_p(sizeof x) ? sizeof x: sizeof > (void*))
I don't see how this would work. If x is a variable-sized array, CT_SIZEOF(x) is not a constant expression, according to the C rules, because for A?B:C to be a constant expression, B and C both have to be constant expressions. Besides, there's really not that much need to be worried about older GCC compilers. They are being upgraded all the time, and the problem will go away. In the meantime, we're going to be catching the errors anyway, since we'll be using the newer compilers.