Pointers and integer types - Ecole Nationale du Génie de l'Eau et de l'Environnement de Strasbourg Accéder directement au contenu
Rapport Année : 2022

Pointers and integer types

Résumé

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.
n2822.html (24.53 Ko) Télécharger le fichier
n2889.htm (27.4 Ko) Télécharger le fichier

Dates et versions

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

Licence

Paternité

Identifiants

  • HAL Id : hal-03363711 , version 1

Citer

Jens Gustedt. Pointers and integer types. [Research Report] N2889, ISO JCT1/SC22/WG14. 2022. ⟨hal-03363711⟩
65 Consultations
0 Téléchargements

Partager

Gmail Facebook X LinkedIn More