From mboxrd@z Thu Jan 1 00:00:00 1970 From: chneukirchen@gmail.com (Christian Neukirchen) Date: Thu, 08 Jun 2017 13:28:28 +0200 Subject: [TUHS] Array index history In-Reply-To: <201706071402.v57E2dTs032508@freefriends.org> (arnold@skeeve.com's message of "Wed, 07 Jun 2017 08:02:39 -0600") References: <201706071320.v57DKhmJ026303@freefriends.org> <20170607135004.GB7802@yeono.kjorling.se> <201706071402.v57E2dTs032508@freefriends.org> Message-ID: <87o9tybtwj.fsf@gmail.com> arnold at skeeve.com writes: > Michael Kjörling wrote: > >> On the other hand, before C, both B and BCPL used zero-based indexing. >> So if we trace C's family tree, there is certainly precedence for >> zero-based indexing into arrays. > > Ah. OK. I never used either language. I get the impression that BCPL > wasn't used / known much in the US, but I could be wrong. I was exposed > to BASIC and FORTRAN (and computer programming) circa 1976 and to C > in 1980. Anything before then is before my time ... :-) It may be obvious, but awk(1) uses 1-indexing for arrays and string offsets, and shell arguments are indexed from 1 too (which may be reasonable given the special behavior of argv[0], but I think this resulted in rc(1) being 1-indexed for lists). pic(1) sensibly uses 1-indexing in the "Nth" notation. -- Christian Neukirchen http://chneukirchen.org