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: a07f3367d7,fa8a8653458b3e4b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: using the 'use at' feature inside a record? References: <8f6142f2-ea37-46d7-a29c-0498da5dd9da@t13g2000yqn.googlegroups.com> From: Stephen Leake Date: Thu, 10 Sep 2009 19:42:47 -0400 Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (windows-nt) Cancel-Lock: sha1:3Vvnf989ZD1uYF7lZSsoCftbUiw= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 012d94aa98e90e197caa706452 Xref: g2news2.google.com comp.lang.ada:8279 Date: 2009-09-10T19:42:47-04:00 List-Id: PForan writes: > I have a question about the "use at" feature and how it can be used > inside a record to simulate C's unions. I often have an array of > bytes, as well as a string which is "use at"'ed on top of the byte > buffer, very useful as I can play with the data in any way I choose. > i.e. > > byte_buf: array(1..100) of unsigned_8; > str_buf: string(1..100); > for str_buf use at byte_buf'address; > > Is it possible to have something like this within a record? 'use at' is obsolete (LRM J.7); you should now use: for str_buf'address use byte_buf'address; If you are implementing an Ada variant record type that must match a C union type that has no field for the discriminant, use pragma Unchecked_Union (LRM B.3.3). -- -- Stephe