casting - C++ Cast increment cast -
someobject* scratchpad[10000][33];
i want in 1 statement:
unsigned int index = (int) scratchpad[j][0]; scratchpad[j][0] = (someobject*) (index + 1);
i thought was:
unsigned int index = (unsigned int) ++((char*)scratchpad)[j][0];
but can't quite syntax right. i'm storing integer in first (0) sub-array index.
don't store integer in first sub-array index. store elsewhere. seriously. don't this.
but if you're absolute maniac who's goal make people hate you, works, on assumption unsigned int
no bigger pointer.
unsigned index = ++reinterpret_cast<unsigned&>(scratchpad[j][0]);
Comments
Post a Comment