size_t + ptrdiff_t

Stewart Gordon smjg_1998 at yahoo.com
Sun Feb 19 09:09:13 PST 2012


On 19/02/2012 16:07, Daniel Murphy wrote:
> "Vladimir Panteleev"<vladimir at thecybershadow.net>  wrote in message
> news:valucopzdhxdjymkgvuq at forum.dlang.org...
>> On Sunday, 19 February 2012 at 15:26:27 UTC, Manu wrote:
>>> There is code that assumes size_t is the width of the pointer
>>
>> When is this not true? I can only think of 16-bit far pointers.
>
> 8-bit embedded quite often has 16-bit pointers.

And has an 8-bit size_t?

Just found the bit I read before and was trying to find again
http://www.dlang.org/portability.html
"Use size_t as an alias for an unsigned integral type that can span the address space. 
Array indices should be of type size_t."

Of course, anything below 32-bit is irrelevant to D, but according to cplusplus.com size_t 
is defined to be the type returned by sizeof.  But where it explains sizeof it doesn't 
state what type that is, and I don't know what the C or C++ standard says about it.

Stewart.


More information about the Digitalmars-d mailing list