size_t + ptrdiff_t

Iain Buclaw ibuclaw at ubuntu.com
Tue Feb 21 23:23:31 PST 2012


On 22 February 2012 02:19, Walter Bright <newshound2 at digitalmars.com> wrote:
> On 2/21/2012 1:03 AM, Artur Skawina wrote:
>>
>> Types like ptrdiff_t are not necessary in D, because you can write
>> portable
>> code using 'auto' and 'typeof()' - std C didn't have these, so a type had
>> to be invented for everything.
>
>
> And, in fact, object.di contains:
>
>
> alias typeof(int.sizeof)                    size_t;
> alias typeof(cast(void*)0 - cast(void*)0)   ptrdiff_t;

But as far as I can see, size_t and ptrdiff_t have a special meaning
inside the compiler, and you can change their alias at will (though
I've never tried).


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list