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,ab132517972acd5f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news3.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread3.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: accessing record element (question to the pros) References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Fri, 24 Feb 2006 18:02:09 GMT NNTP-Posting-Host: 67.150.73.89 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.pas.earthlink.net 1140804129 67.150.73.89 (Fri, 24 Feb 2006 10:02:09 PST) NNTP-Posting-Date: Fri, 24 Feb 2006 10:02:09 PST Xref: g2news1.google.com comp.lang.ada:3143 Date: 2006-02-24T18:02:09+00:00 List-Id: Norbert Caspari wrote: > Could somebody please help me to correct my code, showing me how to access > a numeric value to the variable Yyy. You can't, because Yyy is not of a numeric type. However, in general, you can't do what you seem to be trying to do. Variant records do not allow unchecked type conversion; the language rules prohibit it. That's what Ada.Unchecked_Conversion is for. For the specific problem of accessing bits in an unsigned integer, you can use the logical operators on modular types: and, or, Shift_Right, and so on. For a signed integer, you can unchecked convert to an array of Boolean, but then you have a portability problem: is the LSB in 'First or 'Last? This is not defined by the language. -- Jeff Carter "I've got to stay here, but there's no reason why you folks shouldn't go out into the lobby until this thing blows over." Horse Feathers 50