[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: intptr_t vs. uintptr_t

From: Paul Eggert
Subject: Re: intptr_t vs. uintptr_t
Date: Mon, 16 Dec 2019 02:02:46 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

On 12/14/19 4:35 PM, Bruno Haible wrote:
> the advice can be simplified: If pointer arithmetic
> is involved, uintptr_t is better suited than intptr_t. And if pointer 
> arithmetic
> is not involved, uintptr_t and intptr_t are equivalent and equally good.

It's more complicated in Emacs, because Emacs sometimes converts small integers
to pointers and then back again, and these integers can be negative. (The C
standard doesn't guarantee that this works, but Emacs is deliberately
nonportable in this low-level area and it does work on Emacs's current
platforms.) For such conversions, signed integers are more convenient.

It is a messy area, admittedly.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]