Different behavior of compilers with array allocation

后端 未结 3 1760
旧时难觅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:28

    C99 (the most recent version of the C standard) does allow dynamically sized arrays. However, the feature is not supported by Visual Studio (which only implements C89 support)

    In C++ it is not, and probably will never be, valid.

提交回复
热议问题