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 10.182.49.136 with SMTP id u8mr11255884obn.32.1404669173306; Sun, 06 Jul 2014 10:52:53 -0700 (PDT) X-Received: by 10.140.47.102 with SMTP id l93mr437885qga.5.1404669173250; Sun, 06 Jul 2014 10:52:53 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!uq10no2140196igb.0!news-out.google.com!a8ni6411qaq.1!nntp.google.com!i13no6458545qae.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 6 Jul 2014 10:52:53 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=206.53.78.59; posting-account=ShYTIAoAAABytvcS76ZrG9GdaV-nXYKy NNTP-Posting-Host: 206.53.78.59 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <50e9d044-6d13-435d-bffa-62713410c159@googlegroups.com> Subject: Re: 'Size hack for enumerated types From: sbelmont700@gmail.com Injection-Date: Sun, 06 Jul 2014 17:52:53 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:20747 Date: 2014-07-06T10:52:53-07:00 List-Id: On Sunday, July 6, 2014 12:16:00 PM UTC-4, Victor Porton wrote: >=20 > Your way does not work backward (K^{-1}). >=20 Sure it can, contingent on the C enum not being declared in any sort of ina= ne manner: subtype E is Interfaces.C.int range 1 .. 3; K_Inv : constant array (E) of T :=3D (1 =3D> x; 2 =3D> y; 3 =3D> z); Of course, any number of stupid programmer tricks could have been done on t= he other end to put gaps in the values, have multiple elements with the sam= e value, or even make them implementation-defined non-integer numbers, in w= hich case all bets are off. Though all bets are off anyway, since there is= no reason to expect a C function to return a valid value in the first plac= e. -sb