Bug? 0 is less than -10
Laeeth Isharc via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Oct 8 11:38:23 PDT 2015
On Thursday, 8 October 2015 at 13:32:17 UTC, Steven Schveighoffer
wrote:
> On 10/7/15 1:27 AM, Laeeth Isharc wrote:
>> On Wednesday, 7 October 2015 at 02:53:32 UTC, Steven
>> Schveighoffer wrote:
>>> On 10/6/15 7:21 PM, Laeeth Isharc wrote:
>>>> could we have ssize_t defined in phobos somewhere so your
>>>> code ends up
>>>> being portable ;) (It's trivial to do, obviously).
>>>
>>> ptrdiff_t
>>>
>>
>> It seems unnatural to use such a name when the variable has
>> nothing to
>> do with pointers - it doesn't contribute to the readability.
>> Yes, it's
>> trivial, but small things cumulatively matter. Adam tends to
>> use int
>> and when that gets mixed up with an auto size_t (eg via
>> length) then his
>> code doesn't compile on 64 bit. And if it happens with his
>> code, you
>> can imagine this isn't a problem that inexperienced users
>> never encounter.
>
> ptrdiff_t is in the C spec, ssize_t is not. No reason to name
> all the types of snow here.
>
> A machine-word-sized signed integer is ptrdiff_t.
>
> -Steve
Whatever - it's not that important to me. D isn't C, and has
learnt from C's mistakes and infelicities. I love the beauty of
C, but I'm glad I don't need to do my work in it. One reason why
D is under appreciated is that these seemingly small differences
make a big difference in practice, even if in theory they
shouldn't. Initially I was quite offended by no loop aliasing.
Until I saw how much time it saved me in avoiding silly mistakes.
But really there are better things to worry about at the moment.
Laeeth.
More information about the Digitalmars-d-learn
mailing list