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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,74b958f114ec4924 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!cyclone1.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny05.POSTED!c2bfcbcf!not-for-mail Subject: Re: Type convertion From: "Ed Falis" Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Newsgroups: comp.lang.ada References: <47d6ae9b$1@news.broadpark.no> Content-Transfer-Encoding: 7bit Message-ID: User-Agent: Opera Mail/9.26 (Linux) Date: Tue, 11 Mar 2008 16:59:47 GMT NNTP-Posting-Host: 71.184.110.64 X-Complaints-To: abuse@verizon.net X-Trace: trndny05 1205254787 71.184.110.64 (Tue, 11 Mar 2008 12:59:47 EDT) NNTP-Posting-Date: Tue, 11 Mar 2008 12:59:47 EDT Xref: g2news1.google.com comp.lang.ada:20299 X-Original-Bytes: 1513 Date: 2008-03-11T16:59:47+00:00 List-Id: On Tue, 11 Mar 2008 12:10:35 -0400, news.broadpark.no wrote: > I have a simple question. I'm working on an Ada package I have received. > > - Is it possible to covert a Boolean to Integer in an easy way > - Is it possible to covert an enum to Integer in an easy way > > In the second question i typically have something like this: > > type My_Type is (AB, CD, EF, GH, IJ); > > Now, I have a declaration: > > MyTest : My_Type; > > The result is stored in MyTest. I'm writing an interface to a C based > program and I need to convert it to Integer. I'm new to Ada, so any hint > would help. > > Eirik > I expect: pragma Convention (C, My_Type); would do the trick for you.