comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: access aliased obstacle
Date: 1996/07/09
Date: 1996-07-09T00:00:00+00:00	[thread overview]
Message-ID: <dewar.836941369@schonberg> (raw)
In-Reply-To: ws9enml495d.fsf@schonberg.cs.nyu.edu


Laurent said

"   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)."

Not quite right, there is no reason why a discriminant in a variant record
should be stored "in the record" in Ada, that is just a (common)
implementation choice. In fact if you are using sub types extensively
it is attractive to choose an alternative representation where the
discriminants are stored separately,

However, the point about discriminant checks is right of course (although
if one had an implementation which stored discriminants separately, you
would get almost what you wanted simply by suppressing these checks).





  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 [this message]
1996-07-09  0:00 ` Laurent Guerby
1996-07-09  0:00   ` Robert Dewar
1996-07-10  0:00     ` Robert A Duff
  -- 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