Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!uw-beaver!apollo!mrst!sdti!turner From: turner@sdti.UUCP (Prescott K. Turner) Newsgroups: comp.lang.misc Subject: Re: The Joy of Zero-based Arrays Message-ID: <213@sdti.UUCP> Date: 4 Mar 88 18:07:00 GMT References: <1012@PT.CS.CMU.EDU> <17419@think.UUCP> Reply-To: turner%sdti@harvard.harvard.edu (Prescott K. Turner, Jr.) Organization: Software Development Technologies, Sudbury MA Lines: 26 Summary: One-based numbering is natural. As someone said, people do 1-based counting. (Sorry, I can't find the reference to quote.) A child learns to count by pointing at the objects and reciting the numbers, as "one, two, three". The counting process naturally labels the objects in a one-based fashion. Are any of you zero-based partisans teaching your children to recite "zero, one, two" and then deduce the cardinality to be three? I have seen pros and cons to zero-based arrays, and don't really mind them in a programming language. What I do mind is when it spills over into user interfaces and even human discourse. When the cursor is blinking in the first column of my screen, my text editor should report the column number as 1, not 0. (I know, my text editor is wishing it could put the cursor just to the left of the first column, not smack on top of the first column, but when it resorts to the latter real problems result.) And in Dijkstra's letter in the June 1987 CACM, he numbers his points and his references starting with 0. I find this annoying and wrong-headed. Since computer programs must relate to humans at some point, it is desirable to stick with the human convention that when labeling things by counting, you start with 1. And this applies to arrays. -- Prescott K. Turner, Jr. Software Development Technologies, Inc. 375 Dutton Rd., Sudbury, MA 01776 USA (617) 443-5779 UUCP:necntc!necis!mrst!sdti!turner