My favourite game: DMD guess the error reason.
Iain Buclaw via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 2 12:21:01 PDT 2016
On Monday, 2 May 2016 at 19:14:59 UTC, Steven Schveighoffer wrote:
> On 5/2/16 2:25 PM, Iain Buclaw wrote:
>> On Monday, 2 May 2016 at 16:24:40 UTC, Steven Schveighoffer
>> wrote:
>>> On 5/2/16 3:13 AM, Iain Buclaw wrote:
>>>> [2]: The ptrdiff_t and size_t types have a different size.
>>>
>>> Wow, it would be a copy-paste error of some sort? An
>>> interesting
>>> possibility. But I'm going to say no, I don't see how this
>>> comes into
>>> play for the template constraints.
>>>
>>
>> While there may be an alias in object.d, I'd say it's purpose
>> is purely
>> cosmetic (and to prevent missing symbol errors). It is the
>> compiler
>> that decides what types size_t, ptrdiff_t have. And while
>> there are
>> targets where word and pointer sizes are different, GDC does
>> not honour
>> this however, as the D specification on these types (and
>> D_LP64) trumps
>> that.
>
> So you are saying that:
>
> int * p;
> int[] arr;
> assert(typeof(p - p).sizeof == typeof(arr.length).sizeof);
>
> could fail regardless of how object.d defines size_t and
> ptrdiff_t? I can't imagine much would work. Interesting note
> though.
>
> I've worked with processors that have different word and
> pointer sizes, but they were all too weak to be able to use D
> (if you used betterc switch maybe).
>
Yes, although I'm not aware of LDC doing this. I can say that
GDC will always pick int/uint or long/ulong. Maybe at some point
I should allow short/ushort for 16bit targets.
--
Iain
More information about the Digitalmars-d
mailing list