Hi,
I have been reading in a lot of places that using reinterpret_cast is bad but they never explain the reason for it. I use it a lot in my code to convert int to char * since I need to send the individual bytes of the int across a network.
<CODE>
char *byteCrcPtr = NULL;
DWORD byteCrc = 0xFF23F2e4;

byteCrcPtr = reinterpret_cast<char *>(&byteCrc);
for(int i=0;i<sizeof(DWORD);i++) {
packet[i]= byteCrcPtr[i];
}

</CODE>

To convert back
<CODE>

DWORD byteCrc = *(reinterpret_cast<DWORD*>(&packet[9]));
</CODE>

I especially want to understand why this is bad and is there a better way to do this. Thanks
Amish