Bug? 0 is less than -10

Andrea Fontana via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 7 00:38:43 PDT 2015


On Wednesday, 7 October 2015 at 05:27:12 UTC, 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
>>
>> -Steve
>
> 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.

IMO it seems unnatural to use size_t with a signed/negative value 
too.



More information about the Digitalmars-d-learn mailing list