No, this is not the best way to do something. However, for the sake of theory, how could one assign the value of a pointer to a pointer to an anonymous structure?
#pragma pack(push,1) struct { __int16 sHd1; __int16 sHd2; } *oTwoShort; #pragma pack(pop) oTwoShort = (unsigned char*)msg;
gives:
error C2440: '=': cannot convert from 'unsigned char *' to '<unnamed-type-oTwoShort> *'
The example assumes msg is a valid pointer.
Is it possible? Since you don't have the actual type, can you even come up with?
source share