Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is size_t is always unsigned int [duplicate]

Tags:

c++

size-t

Are there any implementations that have size_t defined as something else than unsigned int? Under every system I worked, it was defined as unsigned int, so I'm just curious.

like image 431
Pilpel Avatar asked Dec 02 '22 15:12

Pilpel


1 Answers

x86-64 and aarch64 (arm64) Linux, OS X and iOS all have size_t ultimately defined as unsigned long. (This is the LP64 model. This kind of thing is part of the platform's ABI which also defines things like function calling convention, etc. Other architectures may vary.) Even 32-bit x86 and ARM architectures use unsigned long on these OSes, although long happens to be the same representation as an int in those cases.

I'm fairly sure it's an unsigned __int64/unsigned long long on Win64. (which uses the LLP64 model)

like image 178
pmdj Avatar answered Dec 24 '22 17:12

pmdj