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]); 

http://coliru.stacked-crooked.com/a/99043130e74913f9


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -