intptr_t is normally defined in stdint.h, which MSVC didn't have until the 2010 version. MSVC does however define it in stddef.h instead (similarly to how it's defined here). I could include stddef.h conditionally instead of doing a manual typedef of it here, if you'd prefer that.

Alternatively I could use ptrdiff_t, which is available in both MSVC and unices in stddef.h, but that's semantically less correct than intptr_t for most of these.