Monday, 15 July 2013

What is the equivalent for C++ const size_t in C#? -



What is the equivalent for C++ const size_t in C#? -

i'm trying translate ogre code it's c# version , ran problem :

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 };

basically, const size_t doesn't exist in c#, , const int can't used declare array's size.

i wondering how declare arrays constant value?

size_t typedef (kind of #define macro) alias type. definition depends on sdk, it's unsigned int.

anyway, in case doesn't matter because they're constants, know nvertices 8 , vbufcount 48. can write in c#:

const int nvertices = 8; const int vbufcount = 3 * 2 * nvertices; float[] vertices = new float[vbufcount] { -100.0,100.0,-100.0, //0 position -sqrt13,sqrt13,-sqrt13, //0 normal //... -sqrt13,-sqrt13,sqrt13, //7 normal };

c# c++

No comments:

Post a Comment