我想这是C#版本翻译一些食人魔代码,我遇到了一个问题:在C#中C++ const size_t的等价物是什么?
const size_t nVertices = 8;
const size_t vbufCount = 3*2*nVertices;
float vertices[vbufCount] = {
-100.0,100.0,-100.0, //0 position
-sqrt13,sqrt13,-sqrt13, //0 normal
//...
-sqrt13,-sqrt13,sqrt13, //7 normal
};
基本上,常量为size_t并不在C#中存在,const int的,不能用来声明数组的大小。
我想知道如何声明具有常量值的数组?
您不需要显式编写数组的大小,至少不用C++。 – leemes 2013-02-09 13:09:50
数组已经固定,所以没有必要根据常量来设置其大小。 – David 2013-02-09 13:10:05