On Jun 8, 2017 7:29 AM, "Christian Neukirchen" <chneukirchen@gmail.com> wrote:
arnold@skeeve.com writes:

> Michael Kjörling <michael@kjorling.se> 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.

I never thought of it like that wrt awk. However, I always thought of $0 as "self" in higher level OO languages.