On 23Jun2019 02:28, vincent lefevre <vinc...@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) -1
above.

Sorry, I misunderstood.

Cheers,
Cameron Simpson <c...@cskk.id.au>

Reply via email to