From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a24:e4cf:: with SMTP id o198mr1778157ith.20.1548246623783; Wed, 23 Jan 2019 04:30:23 -0800 (PST) X-Received: by 2002:aca:308d:: with SMTP id w135mr58779oiw.0.1548246623548; Wed, 23 Jan 2019 04:30:23 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.215.MISMATCH!k10no839156itk.0!news-out.google.com!v71ni962ita.0!nntp.google.com!q69no839582itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 23 Jan 2019 04:30:23 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=94.126.240.2; posting-account=Rb9AYAoAAACJxfG9wutXlaLWNAfJy4_j NNTP-Posting-Host: 94.126.240.2 References: <3d782720-227d-4d86-b403-eacbd1b9d0d2@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Problem with Position of the enumeration Type From: Luis Ladron de Guevara Moreno Injection-Date: Wed, 23 Jan 2019 12:30:23 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:55337 Date: 2019-01-23T04:30:23-08:00 List-Id: El mi=C3=A9rcoles, 23 de enero de 2019, 12:32:49 (UTC+1), Mark Lorenzen es= cribi=C3=B3: > On Wednesday, January 23, 2019 at 11:06:01 AM UTC+1, Luis Ladron de Gueva= ra Moreno wrote: > > Hello, > >=20 > > I have an issue with the declaration of the enumeration type, when i tr= y to map the values of an enumeration to a specific position. > >=20 > > the code: > >=20 > > procedure EnumerationTest is > >=20 > > Position : Integer; > > =20 > > type E_Test is (Pos10, Pos11, Pos12, Pos13, Pos14); > >=20 > > for E_Test use (Pos10 =3D> 10, > > Pos11 =3D> 11, > > Pos12 =3D> 12, > > Pos13 =3D> 13, > > Pos14 =3D> 14); > >=20 > > begin > >=20 > > for I in E_Test'Base loop > > =20 > > Position :=3D E_Test'pos (I); > > ada.Text_IO.Put (" Position: " & Position'Img & " Value: " & I'Im= g); > > end loop; > >=20 > > end EnumerationTest; > >=20 > > i thought that the result of the position was 10, 11, 12, 13, 14. But W= hen i run this code, the result is 0, 1, 2, 3. I don't know what it is the = exactly meaning of: > > =20 > > for E_Test use (Pos10 =3D> 10, > > Pos11 =3D> 11, > > Pos12 =3D> 12, > > Pos13 =3D> 13, > > Pos14 =3D> 14); > >=20 > > and how can i assign a different position for the specific value. > > Could anyone help me with this problem? > >=20 > > Thank you so much =3D) >=20 > What problem are you trying to solve? Defining the representation of enum= eration values is normally only useful when doing I/O i.e. when you need to= map an integer value to an enumeration value. >=20 > Regards, >=20 > Mark L My problem is that i thougth that when i write:=20 for E_Test use (Pos10 =3D> 10, Pos11 =3D> 11, Pos12 =3D> 12, Pos13 =3D> 13, Pos14 =3D> 14); the numbers 10, 11, 12... was the position of the enumeration and when i tr= ied to use ex. 'Pos(Pos12) i obtained a 2. The position of the values cann= ot be modified. these values are the representation of the enum, i understa= nd.