Disable variable-length automatic arrays in gcc

后端 未结 2 1345
借酒劲吻你
借酒劲吻你 2020-11-28 12:53

I couldn\'t disable it even though by using -std=c89 flag. How can I disable it?

相关标签:
2条回答
  • 2020-11-28 13:37

    Variable-length arrays in C89?

    GCC always supported variable length arrays AFAIK. Setting -std to C89 doesn't turn off GCC extensions ...

    See also:

    https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html

    http://tigcc.ticalc.org/doc/gnuexts.html#SEC76

    Finally,

    http://tigcc.ticalc.org/doc/gnuexts.html

    '-pedantic' and other options cause warnings for many GNU C extensions. You can prevent such warnings within one expression by writing __extension__ before the expression. __extension__ has no effect aside from this.

    0 讨论(0)
  • 2020-11-28 13:41

    You can generate an error for variable length arrays using a compiler flag:

    -Werror=vla
    
    0 讨论(0)
提交回复
热议问题