On Wed, Jul 18, 2007 at 08:54:36PM +0900, Robert Dober wrote:
> On 7/18/07, MenTaLguY <mental / rydia.net> wrote:
> >On Wed, 2007-07-18 at 16:20 +0900, kevin cline wrote:
> >> > The pebble in the Ruby shoe is the counter-intuitive use of indexing of
> >> > elements of arrays, strings, etc., from 0 to n-1 instead of the more
> >> > natural 1 to n.
> >>
> >> With 50+ years of collective experience, it seems clear that zero-
> >> based arrays lead to the simplest code.
> >
> >That's been my personal experience, too -- pretty much the only thing
> >1-based indices make simpler is getting the last element of an array
> >given its size; everything else seems to get more complex.
> >
> I do not like categorical statements, but this one might be the
> exception that confirms the rule.
> +1 (or was that +0 ;)

Actually, that should probably be ++.

That brings up a good point, though.  For rating systems and other needs
that work on similar principles, you're better off with zero-based
arrays.

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Amazon.com interview candidate: "When C++ is your hammer, everything starts
to look like your thumb."