[cfe-dev] sizeof(sizeof(...))
Neil Booth
neil at daikokuya.co.uk
Fri Dec 14 18:06:12 PST 2007
Ted Kremenek wrote:-
> > is this valid:
> >
> > char[n*m] foo(int n, int m) { ... }
> > ...
> > a=sizeof(foo(x,y))
> > ?
>
> This (I believe) is not valid, and I couldn't get gcc to compile
> similar code. From the standard: "All declarations of variably
> modi?ed (VM) types have to be either block scope or function
> prototype scope."
It's invalid for a different reason (and one clang doesn't
implement, ahem): the return type of a function declarator
cannot have array type.
Neil.
More information about the cfe-dev
mailing list