display | more...

There are different schools of thought as to the correct method of idexing elements of an array. Pascal-like languages, such as Ada use 1 to indicate the first element in an array, because they don't trust people and assume that everyone counts with their fingers.

Languages similar to C (Java etc) use , because their way of thinking is that the index represents how many memory segments away from the beginning of the array that member is. Eg array[i] is equivalent to *(array + i) in fact, that's what happens eventually, when the array degrades into a pointer.

In my experiences with computer languages, I have noticed a distinct correlation between the lowest allowed index for an array and how anal that language is. Ada tries to catch any little mistake you make, while C just assumes that you know what you're doing, until you dump core.

The designers of Ada believe their way is best while the designers of C assume that yours is. It is no mistake that Perl allows you to have negative indexes for it's arrays, for Perl knows that There is More than one way to do it.

Wicker808 points out that Modern Pascals let you specify an arbitrary low index. viz:

var q:array(.5..23.) of byte;

Log in or register to write something here or to contact authors.