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.70.135.129 with SMTP id ps1mr10568608pdb.8.1404652918297; Sun, 06 Jul 2014 06:21:58 -0700 (PDT) X-Received: by 10.140.27.182 with SMTP id 51mr24304qgx.8.1404652918210; Sun, 06 Jul 2014 06:21:58 -0700 (PDT) Path: border2.nntp.dca.giganews.com!nntp.giganews.com!border1.nntp.hkg.giganews.com!news.netfront.net!news.glorb.com!hn18no4008570igb.0!news-out.google.com!a8ni6411qaq.1!nntp.google.com!i13no6406287qae.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 6 Jul 2014 06:21:58 -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: Subject: Re: 'Size hack for enumerated types From: sbelmont700@gmail.com Injection-Date: Sun, 06 Jul 2014 13:21:58 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: number.nntp.dca.giganews.com comp.lang.ada:187391 Date: 2014-07-06T06:21:58-07:00 List-Id: On Saturday, July 5, 2014 4:32:10 PM UTC-4, Victor Porton wrote: > > What is a better way to do this? > I prefer something along these lines: type T is (x, y, z); K : constant array (T) of Interfaces.C.int := (x => 1, y => 2, z => 3); C_Function(arg => K(x)); You lose a little by having to declare the array (assuming it cannot be optimized away), but can have any size you desire for T, plus you get to explicitly specify how the enum maps. -sb