"IndexType" for ranges

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Tue Oct 2 15:58:44 PDT 2012


On Tue, 02 Oct 2012 19:23:48 +0200
"Jonathan M Davis" <jmdavisProg at gmx.com> wrote:

> On Tuesday, October 02, 2012 19:10:53 monarch_dodra wrote:
> 
> Ideally, only size_t would be allowed. Reality makes it so that we
> need ulong in some cases (e.g. iota). Given that fact, you'd ideally
> restrict it to size_t or ulong specfically (or at least
> IndexType.sizeof >= size_t.sizeof). The problem is that I'm quite
> sure that there are plenty of programmers out there who have been
> using int for length and indices even though it's a horribly bad
> idea. It's a classic mistake.
> 

Yea, typing "int" tends to be automatic enough, and then the
awkwardness of "size_t" on top of that tends to ensure it doesn't get
used as much as it should.



More information about the Digitalmars-d mailing list