Does anyone know any toolchain/platform/target combination where the maximum value of size_t
is smaller than the maximum value of unsigned int
?
I think both the C and C++ standards allow this in principle and it might (in theory) be useful on some wierd MCUs, but I've never seen this in practice.
Note:
I deliberately tagged this with both c and c++, as I'm interested in answers for both languages (if your answer is language specific, please say so) and I haven't yet seen any toolchain/target combination that uses different sizes for those types in c and c++ anyway.
H8/300 can be configured to. With GCC (configured with triple h8300-elf
or h8300-rtems
), this is the -mint32
flag:
gcc/config/h8300/h8300.h:555:
#define SIZE_TYPE \
(TARGET_H8300 || TARGET_NORMAL_MODE ? TARGET_INT32 ? "short unsigned int" : "unsigned int" : "long unsigned int")
So when -mint32
is passed making 32-bit int
, size_t
is based on 16-bit short
.
(Also note that, per comments in that file, GCC requires that size_t
and void *
must be the same size)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With