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-24 01:31:14 PST Path: nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!xlink.net!howland.reston.ans.net!gatech!udel!news.mathworks.com!uunet!intrepid.intrepid.com!usenet From: vladimir@speedy.intrepid.com (Vladimir Vukicevic) Newsgroups: comp.lang.ada Subject: Re: C++ to Ada95, help please Date: 24 Mar 1995 09:07:28 GMT Organization: Intrepid Technology, Inc. Message-ID: References: <3kjd2m$d3t@jerry.rb.icl.co.uk> NNTP-Posting-Host: speedy.intrepid.com In-reply-to: sal714@rs710.gsfc.nasa.gov's message of 23 Mar 1995 18:01:33 GMT Date: 1995-03-24T09:07:28+00:00 List-Id: In article sal714@rs710.gsfc.nasa.gov (Stephen A. Leake) writes: : type DISCRIMINANTS is (One, Two); : for DISCRIMINANTS use (One => ?, Two => ?); : type struct_STRUCT_NAME (item1 : DISCRIMINANTS) is : record : case item1 is : when One => : u_item1 : int; : when Two => : u_item2 : int; : end case; : item2 : int : end record; : : If item1 (or item2) is not used in this way, there is no direct Ada : equivalent structure (and the C code is not very good!). Of course, a representation clause for the record is needed above, as there are no guarantees that the Ada compiler will arrange this record in memory to correspond to the C struct/union. Something like the following is needed: for struct_STRUCT_NAME use record item1 at 0 range 0 .. 7; u_item1 at 1 range 0 .. 7; u_item2 at 1 range 0 .. 7; item2 at 2 range 0 ..7; end record; Note that, because of 13.5.1 (11), you can't just define a record rep clause with overlapping components; they must be distinct variants. - Vladimir