logoalt Hacker News

david2ndaccount • yesterday at 7:02 PM • 1 reply • view on HN

Their specification is pretty bad, allowing code like:

    #include <stdio.h>
    #include <stddef.h>
    void v(int y[printf("hello world!\n")]){ 
    }

    int main(){
        v(NULL);
        typedef int wut[printf("oh no\n")];
    }
    $ cc vla.c && ./a.out
    hello world!
    oh no
`typedef`s with side effects...

Replies

uecker • today at 6:13 AM

True, I would also prefer side effects would not be allowed. But simply don't do this. This is not a reason to avoid the feature in general.