So I have always developed in a 32 bit environment, but now have the opportunity to step into 64 bit development. What I am working on requires a lot of pointer aritmatic, and I am a little confused how primitive data type sizes vary from 32 to a 64bit platform. So what I know is pointers in a 32bit environment are 4 bytes and 8 bytes in a 64bit environment, but is their anything else I need to look out for? And how would you solve void pointer arithmatic in a 64 bit environment? Just divide the size(8) by 2 to get back to 4?
For example this is what I can do in a 32 bit environment:
void CopyData(void* data, int dataTypeCount, int dataTypeSize)
{
void** dataCopy = new void*[dataTypeCount * dataTypeSize];
memcpy(dataCopy, data, dataTypeCount * dataTypeSize);
//Go through the copied data to cast to a known data type
for(int i = 0; i < dataTypeCount; i++)
{
KnownType values;
//12 is how ever many bytes you want from the unknown data type structure
//i * (dataTypeSize / sizeof(void*)) will step forward through each element of the void pointer list
memcpy(&values, dataCopy + (i * (dataTypeSize / sizeof(void*))), 12)
}
}