[Info-vax] problem with 64-bit pointers in C

John Reagan xyzzy1959 at gmail.com
Wed Jan 31 07:07:16 EST 2018


The largest possible variable is 32-bits big even with 64-bit pointers.

You can only subtract pointers that point inside the same variable.  

Therefore they can never be more than 32-bits apart.  

That's why ptrdiff_t is always 32.  The type is built into the frontend and can't easily be tweaked by header changes.

You notice that size_t is also 32 even with 64-bit pointers.

Looking back, better choices could have been made.  Going forward, I'd like to have a real LP64 mode with 'long' being 64 to match compilers like clang.

For now, typecast one of them to __int64 at the subtract.



More information about the Info-vax mailing list