comp.lang.ada
 help / color / mirror / Atom feed
From: math.fu-berlin.de!news.belwue.de!news.uni-stuttgart.de!ucaa2385@uunet.uu. net  (Peter Hermann)
Subject: Re: Enum's start at 0?
Date: 7 Jan 93 14:06:20 GMT	[thread overview]
Message-ID: <1993Jan7.140620.5378@news.uni-stuttgart.de> (raw)

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

             reply	other threads:[~1993-01-07 14:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-01-07 14:06 Peter Hermann [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-01-07 15:25 Enum's start at 0? enterpoop.mit.edu!ira.uka.de!math.fu-berlin.de!news.belwue.de!news.uni-st
1993-01-07 13:25 usc!wupost!darwin.sura.net!Sirius.dfn.de!news.belwue.de!news.uni-stuttgar
1993-01-07  8:09 Magn us Kempe
1993-01-06 19:40 Robert I. Eachus
1993-01-06  2:59 Michael Feldman
1993-01-05 22:00 Timothy M. Schreyer
1992-12-30  3:38 Michael Feldman
1992-12-29 14:36 Timothy J. Barton
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox