comp.lang.ada
 help / color / mirror / Atom feed
* Enum's start at 0?
@ 1992-12-29 14:36 Timothy J. Barton
  0 siblings, 0 replies; 9+ messages in thread
From: Timothy J. Barton @ 1992-12-29 14:36 UTC (permalink / raw)


Just curious, but is there a reason enumerated type's POS values
start at 0 instead of 1?

----------------------------------------------------------------------------
Timothy J. Barton                         tim@trident.datasys.swri.edu
Southwest Research Institute (SwRI)
San Antonio, Texas

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Enum's start at 0?
@ 1992-12-30  3:38 Michael Feldman
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Feldman @ 1992-12-30  3:38 UTC (permalink / raw)


In article <238@trident.datasys.swri.edu> tim@trident.datasys.swri.edu (Timothy
 J. Barton) writes:
>Just curious, but is there a reason enumerated type's POS values
>start at 0 instead of 1?
>
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 than
1..128.

Mike Feldman
------------------------------------------------------------------------
Michael B. Feldman
co-chair, SIGAda Education Committee

Professor, Dept. of Electrical Engineering and Computer Science
School of Engineering and Applied Science
The George Washington University
Washington, DC 20052 USA
(202) 994-5253 (voice)
(202) 994-5296 (fax)
mfeldman@seas.gwu.edu (Internet)

"Americans want the fruits of patience -- and they want them now."
------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Enum's start at 0?
@ 1993-01-05 22:00 Timothy M. Schreyer
  0 siblings, 0 replies; 9+ messages in thread
From: Timothy M. Schreyer @ 1993-01-05 22:00 UTC (permalink / raw)


In article <1992Dec30.033842.10112@seas.gwu.edu>, mfeldman@seas.gwu.edu (Michae
l Feldman) writes:
|> In article <238@trident.datasys.swri.edu> tim@trident.datasys.swri.edu (Timo
thy J. Barton) writes:
|> >Just curious, but is there a reason enumerated type's POS values
|> >start at 0 instead of 1?
|> >
|> 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 than
|> 1..128.
|> 
   All right... then why do string indices start at 1? :-)

     Tim
-- 
 Timothy M. Schreyer                         schrey@vfl.paramax.com
 Software Technology R&D                     (215) 648-2475 
 Paramax Systems Corporation                 FAX: (215) 648-2288
 PO Box 517, Paoli, PA 19301

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Enum's start at 0?
@ 1993-01-06  2:59 Michael Feldman
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Feldman @ 1993-01-06  2:59 UTC (permalink / raw)


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 (Micha
el 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 tha
n
>|> 1..128.
>|> 
>   All right... then why do string indices start at 1? :-)
>
Beats me. Anyone out there have an authoritative answer?

Mike Feldman

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Enum's start at 0?
@ 1993-01-06 19:40 Robert I. Eachus
  0 siblings, 0 replies; 9+ messages in thread
From: Robert I. Eachus @ 1993-01-06 19:40 UTC (permalink / 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 writ
es:
   > >   All right... then why do string indices start at 1? :-)

   > Beats me. Anyone out there have an authoritative answer?

   Is there such a thing?  (I assume you don't want me to point to
Appendix C(17) and say because...)  There was a lot of debate on this
in 1981-1982, but as I remember it, it was more concerned with
replacing the subtypes NONNEGATIVE and NATURAL with the more standard
NATURAL and POSITIVE.  Once these were changed STRING changed to
match.

    I guess the real answer is that there was always an expectation
that for "normal" strings 'LENGTH = 'LAST and this requires that
STRINGs be based at one.



--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Enum's start at 0?
@ 1993-01-07  8:09 Magn us Kempe
  0 siblings, 0 replies; 9+ messages in thread
From: Magn us Kempe @ 1993-01-07  8:09 UTC (permalink / raw)


Timothy M. Schreyer asks:
: ... why do string indices start at 1? :-)

A closet Pythagorean in the Ada design team got rational arithmetic
into the compilers; similarly, a disciple of Parmenides strove to
find the one in the many and upheld that what is not, is not.  Thus,
String indices start at 1, not in the void of 0.

Ada is the language for those who have love of wise programming, a
derived type of philosophers.
-- 
Magnus Kempe            "I have sworn ... eternal hostility to every form of
magnus@lglsun.epfl.ch    tyranny over the mind of man."  -- Thomas Jefferson

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Enum's start at 0?
@ 1993-01-07 13:25 usc!wupost!darwin.sura.net!Sirius.dfn.de!news.belwue.de!news.uni-stuttgar
  0 siblings, 0 replies; 9+ messages in thread
From: usc!wupost!darwin.sura.net!Sirius.dfn.de!news.belwue.de!news.uni-stuttgar @ 1993-01-07 13:25 UTC (permalink / 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

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Enum's start at 0?
@ 1993-01-07 14:06 Peter Hermann
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Hermann @ 1993-01-07 14:06 UTC (permalink / 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Enum's start at 0?
@ 1993-01-07 15:25 enterpoop.mit.edu!ira.uka.de!math.fu-berlin.de!news.belwue.de!news.uni-st
  0 siblings, 0 replies; 9+ messages in thread
From: enterpoop.mit.edu!ira.uka.de!math.fu-berlin.de!news.belwue.de!news.uni-st @ 1993-01-07 15:25 UTC (permalink / 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

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1993-01-07 15:25 UTC | newest]

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

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