Pointers and integer types - Archive ouverte HAL Access content directly
Reports Year : 2022

Pointers and integer types

(1)
1

Abstract

The current C standard has the types [u]intptr_t optional, because at the time it was designed mapping pointer representations onto integer types was a challenge. This situation has much changed over time. Processor architectures with pointer or integer instructions that operate on a number of bits that is not a power of 2 or that present standard integer types with padding are rare. In a search for such architectures we recently only found two platforms that still take advantage of the option not to define [u]intptr_t. Both are platforms with 128 bit pointer types that seem to be stuck in the intmax_t ABI trap, which is 64 bit wide for them. Therefore we think that it is time to do our users a service and to harden C’s integer and pointer model such that the [u]intptr_t types aliases become mandatory. This does not mean that we introduce a flat address space nor that pointer arithmetic can generally be reduced to arithmetic in uintptr_t. A second advantage of being able to rely on uintptr_t is the possibility to make the specifications in the memory model TS 6010 simpler and comprehensible. By the proposed change it will be possible to identify the abstract address that corresponds to a pointer value and the uintptr_t value to which it is converted.
Vignette du fichier
n2822.html (24.53 Ko) Télécharger le fichier
Vignette du fichier
n2889.htm (27.4 Ko) Télécharger le fichier

Dates and versions

hal-03363711 , version 1 (04-10-2021)

Licence

Attribution - CC BY 4.0

Identifiers

  • HAL Id : hal-03363711 , version 1

Cite

Jens Gustedt. Pointers and integer types. [Research Report] N2889, ISO JCT1/SC22/WG14. 2022. ⟨hal-03363711⟩
25 View
0 Download

Share

Gmail Facebook Twitter LinkedIn More