What is intptr_t,is it a type for integer or pointer?

前端 未结 2 1681

It\'s defined in /usr/include/stdint.h:

typedef long int                intptr_t;

is it supposed to be a type for integer or p

相关标签:
2条回答
  • 2020-12-10 13:25

    It is a signed integer type that guaranteed to can hold a void* type.

    And why there is also [u]intptr_t? Because:

    Any valid pointer to void can be converted to intptr_t or uintptr_t and back with no change in value. The C Standard guarantees that a pointer to void may be converted to or from a pointer to any object type and back again and that the result must compare equal to the original pointer. Consequently, converting directly from a char * pointer to a uintptr_t is allowed on implementations that support the uintptr_t.

    0 讨论(0)
  • 2020-12-10 13:42

    It is a signed integer type that is big enough to hold a pointer.

    0 讨论(0)
提交回复
热议问题