potentially incorrect conversion of pointer to unsigned long
cs at cskk.id.au
Sun Jun 23 01:50:57 UTC 2019
On 23Jun2019 02:28, vincent lefevre <vincent at vinc17.org> wrote:
>I don't understand what you mean. -1 is *not* some magic value.
>When -1 is converted to the unsigned integer type, it yields the
>maximum value of the type. Thus (uintptr_t) -1 <= (unsigned long) -1
>is true iff unsigned long is at least as large as uintptr_t, i.e.
>when converting a uintptr_t to unsigned long, there is no loss of
>information. This way of checking the size of the unsigned integer
>types in term of values is completely portable (as opposed to sizeof,
>which includes the possible padding bits / bytes).
>No, this is not the intended use of (uintptr_t) -1 and (unsigned long)
Sorry, I misunderstood.
Cameron Simpson <cs at cskk.id.au>
More information about the Mutt-dev