Skip to content

Revert "glib-init: Add more static assertions for gintptr, guintptr"

Simon McVittie requested to merge wip/smcv/redundant-type-assertions into main

On closer inspection, these are redundant with stricter assertions that I added in commit bd1e2a98 "glib-init: Statically assert more facts about standard types", which assert that sizeof (gintptr) == sizeof (void *).

As far as I can tell, a sufficiently pedantic interpretation of Standard C doesn't actually require (u)intptr_t to be the same size as a pointer: it only requires that pointers can be losslessly stored in a (u)intptr_t, which a sufficiently pathological ABI could implement by having (for example) 32-bit pointers and a 64-bit uintptr_t just to troll us. However, I'm fairly confident that no practically useful ABI would do this, and certainly nobody has complained about this assertion since 2020.

Similarly, Standard C might permit an ABI where 64-bit pointers have the first 32 bits always-zero and therefore storing the remaining bits in a 32-bit uintptr_t is lossless, but again, that would be pathological.

This reverts commit da3fc595.

Merge request reports