[cfe-dev] VLAs and cast expressions

Steve Naroff snaroff at apple.com
Thu Feb 14 07:18:15 PST 2008


I believe the code below is legal.

It seems like printf() should always be called, however I couldn't  
find a spec reference to validate this.

snaroff

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;}
>
> -Eli
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list