On Wednesday, 7 October 2015 at 05:27:12 UTC, Laeeth Isharc wrote:Indeed. But you end up with an inferred size_t in a foreach and using length with auto, so it makes sense to have something nicer that you can specify that won't make your code look strange. Doesn't bother me since I define ssize_t, but it might make D easier to read for others. When you see ptrdiff_t with no pointer in sight it's not very clear unless you are familiar with C idioms (and I never remember seeing this back when I learnt C - some modern thing).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 upbeing portable ;) (It's trivial to do, obviously).ptrdiff_t -SteveIt 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.
On Wednesday, 7 October 2015 at 07:38:44 UTC, Andrea Fontana
wrote:
- Bug? 0 is less than -10 tcak via Digitalmars-d-learn
- Re: Bug? 0 is less t... anonymous via Digitalmars-d-learn
- Re: Bug? 0 is less t... Adam D. Ruppe via Digitalmars-d-learn
- Re: Bug? 0 is le... Laeeth Isharc via Digitalmars-d-learn
- Re: Bug? 0 i... Steven Schveighoffer via Digitalmars-d-learn
- Re: Bug?... Laeeth Isharc via Digitalmars-d-learn
- Re: Bug? 0 is less t... Meta via Digitalmars-d-learn
- Re: Bug? 0 is less t... Marc Schütz via Digitalmars-d-learn
- Re: Bug? 0 is le... Dominikus Dittes Scherkl via Digitalmars-d-learn
- Re: Bug? 0 i... Ozan via Digitalmars-d-learn