comp.lang.ada
 help / color / mirror / Atom feed
From: guerby@gnat.com (Laurent Guerby)
Subject: Re: access aliased obstacle
Date: 1996/07/09
Date: 1996-07-09T00:00:00+00:00	[thread overview]
Message-ID: <ws9enml495d.fsf@schonberg.cs.nyu.edu> (raw)
In-Reply-To: 4rsmn6$hvc@news1.delphi.com


>>   I think of a C union as essentially a variant record with the
>> discriminant outside the record (in some other variable entirely).
>> C probably does think of this as a union, although it fits an Ada
>> discriminated record perfectly.  What is this 'Unchecked_Union'?
>> I don't see it in my LRM.

   A discriminated record isn't a C union type, because the
discriminant is stored in the record in Ada (accessible for reading),
and run-time checks are made on the discriminant when you access
variant parts. The pragma Unchecked_Union makes a simple Ada
discriminated record type match exactly a C union (discriminant not
stored, no checks). It is not in the RM, but all vendors agreed to
implement it. It is documented in the GNAT file "features" I think (or
gnatinfo.txt).

   I still assume you're interfacing a C array of union, but I'm not
sure, and cannot be more accurate without the code (C and what you
want in Ada).

-- 
Laurent Guerby <guerby@gnat.com>, Team Ada.
   "Use the Source, Luke. The Source will be with you, always (GPL)."




  parent reply	other threads:[~1996-07-09  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-09  0:00 access aliased obstacle tmoran
1996-07-09  0:00 ` Robert Dewar
1996-07-09  0:00 ` Laurent Guerby
1996-07-09  0:00   ` Robert Dewar
1996-07-10  0:00     ` Robert A Duff
1996-07-09  0:00 ` Laurent Guerby [this message]
1996-07-09  0:00   ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1996-07-04  0:00 tmoran
1996-07-04  0:00 ` Robert Dewar
1996-07-06  0:00 ` Laurent Guerby
1996-07-07  0:00 ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox