<div class="gmail_quote">On 23 January 2012 12:55, Don Clugston <span dir="ltr"><<a href="mailto:dac@nospam.com">dac@nospam.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 22/01/12 00:15, Manu wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On 21 January 2012 22:18, Timon Gehr <<a href="mailto:timon.gehr@gmx.ch" target="_blank">timon.gehr@gmx.ch</a><br></div><div><div class="h5">
<mailto:<a href="mailto:timon.gehr@gmx.ch" target="_blank">timon.gehr@gmx.ch</a>>> wrote:<br>
<br>
    On 01/21/2012 09:06 PM, Alex Rønne Petersen wrote:<br>
<br>
        Hi,<br>
<br>
        I needed a native-size signed integer type this other day and<br>
        was just<br>
        kinda wondering: Why don't we have this in object.di? isize_t or<br>
        whatever?<br>
<br>
        (I have a feeling this has been asked before, but my search-fu<br>
        is weak<br>
        today seemingly...)<br>
<br>
<br>
    .object.ptrdiff_t<br>
<br>
<br></div></div><div class="im">
I don't necessarily think ptrdiff_t and signed size_t are the same thing.<br>
Surely size_t should represent the systems native word width? ptrdiff_t<br>
represents the size of a pointer, which is NOT necessarily the same as<br>
the native word width.<br>
</div></blockquote>
<br>
Yes. Maybe ptrdiff_t is not even the size of a pointer. Do we guarantee a flat address space?<br>
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).<br>
<br>
Maybe similar oddities are possible on the less traditional architectures (Cell, maybe?)</blockquote><div><br></div><div>Cell is too weird to worry about (just treat it as 32bit), but it's fairly common to have embedded systems with 64bit processors which retain 32bit pointers because the memory map is fixed, and there's no point. All games consoles, perhaps even phones with the new 64bit ARM processors. Phones don't need >4gb of ram ;) .. Should size_t on this device be 32 or 64bits? The pointers and OS will still be 32bits, I don't see them releasing an Android-64 any time soon.</div>
</div>