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

Scott Dorsey kludge at panix.com
Wed Jan 31 11:18:04 EST 2018


Joukj  <joukj at hrem.nano.tudelft.nl> wrote:
>What I read from the error message is that the subtraction is performed 
>in 64 bit but afterwards the result is cast to a int (or prtdiff_t). 
>What is the reason for doing this?

Unknown, but if you read the K&R book you'll see none of these operations
are defined.  So you can't count on them doing anything in particular.

>If I run my sample program on a 64-bit Linux system I get the expected 
>results.

You should not expect those results on all systems.  You should write code
that is portable, even in a world where most systems are x86 and most C
compilers are gnu or Microsoft.
--scott
-- 
"C'est un Nagra. C'est suisse, et tres, tres precis."



More information about the Info-vax mailing list