I'm porting some gcc C code to msvc C, it has a lot of pointer offsetting done by simply adding an integer to the pointer like this:
memcpy(data+offset, uhus->elements[i], uhsize);
It seems like C in VS2013 won't allow for that though. I remember reading somewhere that adding an integer to a pointer in C offset it by i*sizeof(datatype of the pointer), wont matter for void* like in the line above but there might be some other types elsewhere and since the software is for flashing firmware, I'd rather avoid bricking my device while testing.
Currently I've replaced the additions like this:
static void* ptrOffset(void* ptr, int offset) {
return (void*)(((int)ptr) + offset);
}
memcpy(ptrOffset(data, offset), uhus->elements[i], uhsize);
Should do the trick, no?