From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 7 Jan 93 15:25:39 GMT From: enterpoop.mit.edu!ira.uka.de!math.fu-berlin.de!news.belwue.de!news.uni-st uttgart.de!ucaa2385@ucbvax.Berkeley.EDU (Peter Hermann) Subject: Re: Enum's start at 0? Message-ID: <1993Jan7.152539.11664@news.uni-stuttgart.de> List-Id: In article <1993Jan6.025929.18871@seas.gwu.edu> mfeldman@seas.gwu.edu (Michael Feldman) writes: >In article <1993Jan5.220007.26218@gvl.unisys.com> schrey@prc.unisys.com writes : >>In article <1992Dec30.033842.10112@seas.gwu.edu>, mfeldman@seas.gwu.edu (Mich ael Feldman) writes: > >[stuff deleted] > >>|> > >>|> Just like everything else in computing. ASCII characters, for example, >>|> run from 0 to 127, not 128. You can represent 0..127 using one less bit th an >>|> 1..128. >>|> >> All right... then why do string indices start at 1? :-) >> >Beats me. Anyone out there have an authoritative answer? > >Mike Feldman shouldn't beat you. Both are reasonable. The first is considered and used more as an "offset". Additionally it coincides well with age-old integer-to-byte and vice versa representation. This representation can well be adopted and is the most likely fitting data format when talking to foreign hardware (in the serendipiduous sense). Additionally, the compiler has the minimum conceivable work. I see no harm with that rule. I see the benefits. The second is naturally used for indexing, which would be extremely disadvantages with a 0 as first index, when working on vector and matrix material, especially for more-dimensional matrices. Here, you do not think in offsets but in elements, e11,e12,e13,... Peter Hermann Newsgroups: comp.lang.ada Subject: Re: Enum's start at 0? Summary: Expires: References: <1992Dec30.033842.10112@seas.gwu.edu> <1993Jan5.220007.26218@gvl.un isys.com> <1993Jan6.025929.18871@seas.gwu.edu> Sender: Followup-To: Distribution: Organization: ica2 Keywords: In article <1993Jan6.025929.18871@seas.gwu.edu> mfeldman@seas.gwu.edu (Michael Feldman) writes: >In article <1993Jan5.220007.26218@gvl.unisys.com> schrey@prc.unisys.com writes : >>In article <1992Dec30.033842.10112@seas.gwu.edu>, mfeldman@seas.gwu.edu (Mich ael Feldman) writes: > >[stuff deleted] > >>|> > >>|> Just like everything else in computing. ASCII characters, for example, >>|> run from 0 to 127, not 128. You can represent 0..127 using one less bit th an >>|> 1..128. >>|> >> All right... then why do string indices start at 1? :-) >> >Beats me. Anyone out there have an authoritative answer? > >Mike Feldman Newsgroups: comp.lang.ada Subject: Re: Enum's start at 0? Summary: Expires: References: <1992Dec30.033842.10112@seas.gwu.edu> <1993Jan5.220007.26218@gvl.un isys.com> <1993Jan6.025929.18871@seas.gwu.edu> Sender: Followup-To: Distribution: Organization: ica2 Keywords: In article <1993Jan6.025929.18871@seas.gwu.edu> mfeldman@seas.gwu.edu (Michael Feldman) writes: >In article <1993Jan5.220007.26218@gvl.unisys.com> schrey@prc.unisys.com writes : >>In article <1992Dec30.033842.10112@seas.gwu.edu>, mfeldman@seas.gwu.edu (Mich ael Feldman) writes: > >[stuff deleted] > >>|> > >>|> Just like everything else in computing. ASCII characters, for example, >>|> run from 0 to 127, not 128. You can represent 0..127 using one less bit th an >>|> 1..128. >>|> >> All right... then why do string indices start at 1? :-) >> >Beats me. Anyone out there have an authoritative answer? > >Mike Feldman shouldn't beat you. Both are reasonable. The first is considered and used more as an "offset". Additionally it coincides well with age-old integer-to-byte and vice versa representation. This representation can well be adopted and is the most likely fitting data format when talking to foreign hardware (in the serendipiduous sense). Additionally, the compiler has the minimum conceivable work. I see no harm with that rule. I see the benefits. The second is naturally used for indexing, which would be extremely disadvantages with a 0 as first index, when working on vector and matrix material, especially for more-dimensional matrices. Here, you do not think in offsets but in elements, e11,e12,e13,... Peter Hermann