On 22/01/12 00:15, Manu wrote:
On 21 January 2012 22:18, Timon Gehr <[email protected] <mailto:[email protected]>> wrote:On 01/21/2012 09:06 PM, Alex Rønne Petersen wrote: Hi, I needed a native-size signed integer type this other day and was just kinda wondering: Why don't we have this in object.di? isize_t or whatever? (I have a feeling this has been asked before, but my search-fu is weak today seemingly...) .object.ptrdiff_t I don't necessarily think ptrdiff_t and signed size_t are the same thing. Surely size_t should represent the systems native word width? ptrdiff_t represents the size of a pointer, which is NOT necessarily the same as the native word width.
Yes. Maybe ptrdiff_t is not even the size of a pointer. Do we guarantee a flat address space? I mean, back in the old 16 bit segmented architecture days, you could have two 32 bit pointers p and q, and have the difference between them being 16 bits (or an error, if the segments were different).
Maybe similar oddities are possible on the less traditional architectures (Cell, maybe?)
There are quite a few 64 bit systems that retain 32bit pointers. I would thing ssize_t is safer than using ptrdiff_t, and certainly, both should exist.
