[cfe-dev] VLAs and cast expressions

Bill Wendling isanbard at gmail.com
Thu Feb 14 22:08:26 PST 2008


On Feb 13, 2008, at 11:22 PM, Eli Friedman wrote:

> Quick question about VLAs: does the following evaluate the printf?  Or
> is the printf only evaluated if the result is needed?  Or is this
> illegal for some reason I'm forgetting?
>
> void* a(void* x) {return (int (*)[10][printf("asdf")])x;}
>
> Similar case which definitely needs to evaluate the printf:
>
> void* a(void* x) {return (*(int (*)[10][printf("asdf")])x)+1;}
>
FWIW, ICC prints "asdf" in both cases.

-bw



More information about the cfe-dev mailing list