I have read several posts on stackoverflow such as size_t vs. uintptr_t and Is sizeof(size_t) == sizeof(void*) always true? and understood that per the C++ standard, the sizes of SIZE_T and void* can be different to account for architectures such as 16-bit segmented architectures.
So I'd like to limit the platforms of my scenario to be Windows, whether it's x86, x64, WoA (Windows on Arm): On Windows, if I malloc to create a pointer of type void*, and I want to do pointer-arithmetic before passing it to memcpy or something, I'd have to something like:
void* p = malloc(100);
memcpy(reinterpret_cast<void*>((reinterpret_cast<SIZE_T>(p) + offset), p2, 100);
Which seems very tedious, especially if you have to litter this type of casting back-and-forth everywhere (I am working with various offsets). Given this is on a Windows platform, I wonder if there's some simplifications that can be made to reduce this type of boilerplate code?
Thanks.