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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d3b2e17058959a22 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-03-22 03:38:24 PST Path: nntp.gmd.de!stern.fokus.gmd.de!ceres.fokus.gmd.de!zib-berlin.de!news.mathworks.com!solaris.cc.vt.edu!news.duke.edu!godot.cc.duq.edu!hudson.lm.com!news.pop.psu.edu!psuvax1!uwm.edu!cs.utexas.edu!math.ohio-state.edu!jussieu.fr!univ-lyon1.fr!swidir.switch.ch!epflnews!dinews.epfl.ch!di.epfl.ch!Robb.Nebbe From: Robb.Nebbe@di.epfl.ch (Robb Nebbe) Newsgroups: comp.lang.ada Subject: Re: C++ to Ada95, help please Date: 22 Mar 1995 11:38:24 GMT Organization: Ecole Polytechnique Federale de Lausanne Sender: nebbe@lglsun3.epfl.ch (Robb Nebbe) Distribution: world Message-ID: <1995Mar22.123048@di.epfl.ch> References: <3kjd2m$d3t@jerry.rb.icl.co.uk> NNTP-Posting-Host: lglsun3.epfl.ch Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: 1995-03-22T11:38:24+00:00 List-Id: In article , 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