Date: Mon, 7 Sep 2026 13:48:51 +0100
'int' is no longer fit for purpose as described in the Standard:
"Plain int's have the natural size suggested
by the architecture of the execution environment"
This isn't abided anymore, as all 64-Bit platforms have 32-Bit int's.
It is for this reason that in my code I use 'uintptr_t' when I need
the 'natural size' integer.
Just this week, I found old code of mine that used 'uintptr_t', and I
went looking for where in the code I converted a pointer to an int --
but I couldn't find it. Then I realised that I was only using that
type as the 'natural' type. So maybe we should have:
namespace std {
typedef intptr_t int_t;
typedef uintptr_t uint_t;
}
"Plain int's have the natural size suggested
by the architecture of the execution environment"
This isn't abided anymore, as all 64-Bit platforms have 32-Bit int's.
It is for this reason that in my code I use 'uintptr_t' when I need
the 'natural size' integer.
Just this week, I found old code of mine that used 'uintptr_t', and I
went looking for where in the code I converted a pointer to an int --
but I couldn't find it. Then I realised that I was only using that
type as the 'natural' type. So maybe we should have:
namespace std {
typedef intptr_t int_t;
typedef uintptr_t uint_t;
}
Received on 2026-09-07 12:49:12
