深海烟花

导航

variably modified 'dist' at file scope|

转自:http://blog.csdn.net/wusuopubupt/article/details/18408227

错误原因:

The reason for this warning is that const in c doesn't mean constant. It means "read only". So the value is stored at a memory address and could potentially be changed by machine code.

在c里静态数组(固定长度的数组,即LISTEN_NUM位置是常数)是允许的,而动态数组(譬如给数组的长度是用变量来表示的)不能写成 UserProfile users[LISTEN_NUM];形式的,只能自行分配内存。

posted on 2016-12-09 11:38  深海烟花  阅读(235)  评论(0编辑  收藏  举报