[cfe-dev] sizeof(sizeof(...))

Neil Booth neil at daikokuya.co.uk
Sat Dec 15 06:53:39 PST 2007


Mike Stump wrote:-

> For fun, try the follow on the old gray matter:
> 
> struct { char o[n][m]; } foo(int n, int m) { }
> 
> int main() {
>    return sizeof(foo(3,4));
> }
> 
> :-)

"/tmp/bug.c", line 1: error: identifier "n" is not defined
struct { char o[n][m]; } foo(int n, int m) { }
                ^
"/tmp/bug.c", line 1: error: identifier "m" is not defined
struct { char o[n][m]; } foo(int n, int m) { }
                   ^
Seems pretty useless :)

Neil.



More information about the cfe-dev mailing list