comp.lang.ada
 help / color / mirror / Atom feed
From: Robb.Nebbe@di.epfl.ch (Robb Nebbe)
Subject: Re: C++ to Ada95, help please
Date: 22 Mar 1995 11:38:24 GMT
Date: 1995-03-22T11:38:24+00:00	[thread overview]
Message-ID: <1995Mar22.123048@di.epfl.ch> (raw)
In-Reply-To: D5tIGu.Cn6@inmet.camb.inmet.com

In article <D5tIGu.Cn6@inmet.camb.inmet.com>, stt@henning.camb.inmet.com (Tucker Taft) writes:

|> 
|> I believe GNAT supports a pragma "Unchecked_Union" (approximately) which
|> is applied to a discriminated record to make it look like a C
|> union.  The basic model is that a C union is essentially an undiscriminated
|> variant record.  The pragma requests the compiler to omit the
|> discriminant in memory, though it still exists "conceptually."

The solution I have used is to declare each variant as a separate type
and use a rep clause for the size. Then I use Unchecked_Conversion to
change between views.

It seems to me that the Unchecked_Union pragma would be a better solution
if the compiler provides it.

Robb Nebbe





  reply	other threads:[~1995-03-22 11:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-20  8:06 C++ to Ada95, help please Simon Johnston
1995-03-21 23:27 ` Kevin F. Quinn
1995-03-22  5:07   ` Vladimir Vukicevic
1995-03-22  1:22 ` Tucker Taft
1995-03-22 11:38   ` Robb Nebbe [this message]
1995-03-23 12:28   ` Mike Meier
1995-03-23 18:31     ` Tucker Taft
1995-03-24 21:24     ` Robert Dewar
1995-03-27 14:58       ` Norman H. Cohen
1995-03-23 13:30   ` Robert Dewar
1995-03-23 18:01 ` Stephen A. Leake
1995-03-24  9:07   ` Vladimir Vukicevic
1995-03-25 10:02     ` Keith Thompson
  -- strict thread matches above, loose matches on Subject: below --
1995-03-08  7:54 Simon Johnston
1995-03-08 13:56 ` Robert A Duff
1995-03-09 21:23 ` Tucker Taft
replies disabled

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