Could we agree to disagree and come together on improvements andclean-up?

NightStrike nightstrike at gmail.com
Sat May 31 16:55:17 CEST 2008


On 5/31/08, Jan Wielemaker <J.Wielemaker at uva.nl> wrote:
> AFAIK, the most important thing realising this is replacing 'long' by
> int/size_t/intptr_t, as appropriate. I had to go through that myself for
> SWI-Prolog. Ok, it is a nightmare and only needed to support Win64 but
> in the end the code gets clearer.

This is true.  Most people write code assuming that the size of long
is equal to the size of a pointer.  This is an invalid assumption that
is not guaranteed by the language standard, and results in code that
is not portable.  On Win64, long is still 32 bits while pointers have
become 64 bits.

It is best to use intptr_t if it is available, and size_t secondary to
that.  Without this change, truncation of memory addresses occurs,
which can be very damaging indeed.  This is the most common and
widespread porting issue.


More information about the gmp-discuss mailing list