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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:d11a:: with SMTP id l26mr1256807iob.34.1548243168437; Wed, 23 Jan 2019 03:32:48 -0800 (PST) X-Received: by 2002:a9d:76c5:: with SMTP id p5mr21784otl.7.1548243168098; Wed, 23 Jan 2019 03:32:48 -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.216.MISMATCH!q69no833877itb.0!news-out.google.com!v71ni960ita.0!nntp.google.com!k10no833434itk.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 23 Jan 2019 03:32:47 -0800 (PST) In-Reply-To: <3d782720-227d-4d86-b403-eacbd1b9d0d2@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=185.34.132.4; posting-account=Srm5lQoAAAAEMX9rv2ilEKR6FDPapmSq NNTP-Posting-Host: 185.34.132.4 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: Mark Lorenzen Injection-Date: Wed, 23 Jan 2019 11:32:48 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:55334 Date: 2019-01-23T03:32:47-08:00 List-Id: On Wednesday, January 23, 2019 at 11:06:01 AM UTC+1, Luis Ladron de Guevara Moreno wrote: > Hello, > > I have an issue with the declaration of the enumeration type, when i try to map the values of an enumeration to a specific position. > > the code: > > procedure EnumerationTest is > > Position : Integer; > > type E_Test is (Pos10, Pos11, Pos12, Pos13, Pos14); > > for E_Test use (Pos10 => 10, > Pos11 => 11, > Pos12 => 12, > Pos13 => 13, > Pos14 => 14); > > begin > > for I in E_Test'Base loop > > Position := E_Test'pos (I); > ada.Text_IO.Put (" Position: " & Position'Img & " Value: " & I'Img); > end loop; > > end EnumerationTest; > > i thought that the result of the position was 10, 11, 12, 13, 14. But When i run this code, the result is 0, 1, 2, 3. I don't know what it is the exactly meaning of: > > for E_Test use (Pos10 => 10, > Pos11 => 11, > Pos12 => 12, > Pos13 => 13, > Pos14 => 14); > > and how can i assign a different position for the specific value. > Could anyone help me with this problem? > > Thank you so much =) What problem are you trying to solve? Defining the representation of enumeration values is normally only useful when doing I/O i.e. when you need to map an integer value to an enumeration value. Regards, Mark L