From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: using the 'use at' feature inside a record?
Date: Thu, 10 Sep 2009 19:42:47 -0400
Date: 2009-09-10T19:42:47-04:00 [thread overview]
Message-ID: <umy5274eg.fsf@stephe-leake.org> (raw)
In-Reply-To: 8f6142f2-ea37-46d7-a29c-0498da5dd9da@t13g2000yqn.googlegroups.com
PForan <pforan@gmail.com> 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
next prev parent reply other threads:[~2009-09-10 23:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-09 20:07 using the 'use at' feature inside a record? PForan
2009-09-10 3:17 ` Per Sandberg
2009-09-10 23:42 ` Stephen Leake [this message]
2009-09-11 13:54 ` PForan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox