Different behavior of compilers with array allocation

后端 未结 3 1657
旧时难觅i
旧时难觅i 2021-01-18 07:37

I recently found a interesting behaviour of g++ when compared with MSVC++ 2008. Consider this tiny program:

#include 

const int ARR_LENGTH =          


        
3条回答
  •  走了就别回头了
    2021-01-18 08:24

    Dynamically sized arrays are a feature of C99. If your compiler supports C99 (GCC does, VC doesn't fully) - and if you throw the C99 switch -, then this will compile.

提交回复
热议问题