On 12/13/19 6:35 PM, Bruno Haible wrote:
>   "Prefer intptr_t for internal representations of pointers"
> 
> I disagree with this advice. uintptr_t ought to be used for representing the
> address of a pointer.

It depends on the application. For example, with two char * pointers P and Q
into an array, it can be helpful that P - Q yields the same integer as
((intptr_t) P - (intptr_t) Q), assuming the usual representation. That's not
true for uintptr_t.

In practice, Emacs uses uintptr_t quite a bit for things like hashes and tags;
but it uses intptr_t a bit more, so the advice seems reasonable for Emacs.

Reply via email to