comp.lang.ada
 help / color / mirror / Atom feed
From: sbelmont700@gmail.com
Subject: Re: 'Size hack for enumerated types
Date: Sun, 6 Jul 2014 10:52:53 -0700 (PDT)
Date: 2014-07-06T10:52:53-07:00	[thread overview]
Message-ID: <50e9d044-6d13-435d-bffa-62713410c159@googlegroups.com> (raw)
In-Reply-To: <lpbsnt$c0a$1@speranza.aioe.org>

On Sunday, July 6, 2014 12:16:00 PM UTC-4, Victor Porton wrote:
> 
> Your way does not work backward (K^{-1}).
> 

Sure it can, contingent on the C enum not being declared in any sort of inane manner:

subtype E is Interfaces.C.int range 1 .. 3;

K_Inv : constant array (E) of T :=
 (1 => x;
  2 => y;
  3 => z);

Of course, any number of stupid programmer tricks could have been done on the other end to put gaps in the values, have multiple elements with the same value, or even make them implementation-defined non-integer numbers, in which 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 place.

-sb

      reply	other threads:[~2014-07-06 17:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-05 20:32 'Size hack for enumerated types Victor Porton
2014-07-05 21:47 ` Simon Wright
2014-07-05 22:11   ` Victor Porton
2014-07-05 22:18     ` Victor Porton
2014-07-05 22:23       ` Victor Porton
2014-07-06 16:25         ` Victor Porton
2014-07-06 20:59       ` Simon Wright
2014-07-06 23:01         ` Victor Porton
2014-07-06 23:30           ` Jeffrey Carter
2014-07-07 16:00             ` Victor Porton
2014-07-07 17:12               ` Simon Wright
2014-07-07 20:23                 ` Victor Porton
2014-07-08  7:04                   ` Simon Wright
2014-07-08 10:17                     ` sbelmont700
2014-07-08 14:53                     ` Dan'l Miller
2014-07-08 20:56                       ` Randy Brukardt
2014-07-08 22:26                         ` Dan'l Miller
2014-07-08 23:18                         ` Jeffrey Carter
2014-07-08  9:43                   ` AdaMagica
2014-07-08 13:52                     ` Victor Porton
2014-07-08 15:02                       ` Simon Wright
2014-07-07  7:45           ` Simon Wright
2014-07-06  7:22     ` Simon Wright
2014-07-06 13:21 ` sbelmont700
2014-07-06 16:16   ` Victor Porton
2014-07-06 17:52     ` sbelmont700 [this message]
replies disabled

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