Different behavior of compilers with array allocation

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

    This is not standard C++ (but standard C). Implementations may provide alloca (or _alloca with msvc) which pretty much does the job.

提交回复
热议问题