Boost logo

Boost :

From: Alan Bellingham (alan_at_[hidden])
Date: 2003-10-28 06:36:52


At Tue, 28 Oct 2003 11:02:50 -0000, Paul Bristow wrote:

>The root cause is the insane choice of zero as index for the first element, but
>that mistake was made decades ago and we have to continue to live with it - or
>use another language.

Not many lifts in Cumbria <grin>? It's not just mathematicians that
count from 0 - so do we Brits when counting floors.

The 24 hour clock counts the hour from 0 to 23.

Ages are indexes - you're age 0 till you have completed a year of life.

Dealing with dates is definitely confusing due to (a) the 1BC + 1 = 1AD
thing, and (b) that the 21st century started at the beginning of 2001.
So indexing from 1 is also insane.

The problem is the difference between a count and an index.
Mathematicians understand the difference, and have a self-consistent
scheme, whereas the rest of us get confused because of the tendency to
try to use them interchangeably.

>So despite being counter-intuitive, I think the existing scheme is the least
>wrong, but it does need plenty of prominent 'skull and crossbones' warnings in
>the documentation.

Not half as much as would counting from 1 though - there would need to
be signs saying 'Although everything else you might encounter in C++ is
indexed from zero, this counts from 1' almost everywhere.

Alan

-- 
Alan Bellingham
(LJ: Bellinghman)

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk