Array start index
pineapple via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Feb 6 10:55:19 PST 2017
One reason for zero-based indexes that isn't "it's what we're all
used to" is that if you used one-based indexes, you would be able
to represent one fewer index than zero-based, since one of the
representable values - zero - could no longer be used to
represent any index.
Also, it's what we're all used to, and it makes perfect sense to
a lot of us, and the only times in recent memory I've ever made
off-by-one errors were when I was trying to use Lua and its
one-based indexing.
More information about the Digitalmars-d-learn
mailing list