Question

On this website: Windows Data Types

the question of the topic arises.

LP stands for long pointer I presume - but there's no long. UINT_PTR stands for unsigned int pointer I presume again - but there's no pointer.

Does someone know the background of this?

Was it helpful?

Solution

Referring "long pointers" (LP-types):

There where times (pre-Pentium) where you had long and short pointers. And as the WINAPI already existed during those times, and today still tries to stay compatible to code of those days, the LPsomething-types survived.

Referring UINT_PTR:

That's an integer wide enough for holding the value of a pointer. The C11-Standard defines such a type as as follows:

7.20.1.4 Integer types capable of holding object pointers

1 The following type designates a signed integer type with the property that any valid pointer to void can be converted to this type, then converted back to pointer to void, and the result will compare equal to the original pointer:

  intptr_t

The following type designates an unsigned integer type with the property that any valid pointer to void can be converted to this type, then converted back to pointer to void, and the result will compare equal to the original pointer:

  uintptr_t

These types are optional.

OTHER TIPS

UINT_PTR is not a pointer type. It is an unsigned integer type of sufficient width to store a pointer value (so its width depends on the target platform). It exists because int and unsigned int are not necessarily wide enough to hold a pointer (particularly on Windows for x64 where int is still 32 bits and pointers are 64 bits).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top