Article View: comp.lang.modula2
Article #40660-based/1-based arrays
From: Richard Pattis
Date: Wed, 02 Mar 1988 18:14
Date: Wed, 02 Mar 1988 18:14
8 lines
906 bytes
906 bytes
I too detest 0-based arrays (and think 1-based arrays are better). In trying to rationalize this choice, I came up the the following argument: When we process arrays, we often need to know the size of the array and/or the position of the last element. In 0-based arrays, these quantites are off by one; in 1-based arrays they are the same. Hence, I think that people will make fewer errors with 1-based arrays. Rich Pattis
Technical Details
Message-ID:
<4343@june.cs.washington.edu>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!ll-xn!mit-eddie!uw-beaver!uw-june!pattisReferences:
<7161@sol.ARPA> <2740@mmintl.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!ll-xn!mit-eddie!uw-beaver!uw-june!pattis From: pattis@june.cs.washington.edu (Richard Pattis) Newsgroups: comp.lang.modula2,comp.lang.misc Subject: 0-based/1-based arrays Message-ID: <4343@june.cs.washington.edu> Date: 2 Mar 88 18:14:51 GMT References: <7161@sol.ARPA> <2740@mmintl.UUCP> Organization: U of Washington, Computer Science, Seattle Lines: 7 Summary: A concrete reason to prefer one over the other