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,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,13703514e3723cbe,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-12 23:06:51 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!netnews.com!xfer02.netnews.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mail From: "Brian Catlin" Newsgroups: comp.lang.ada Subject: C-style 'union' in Ada? Date: Sun, 12 Aug 2001 23:06:13 -0700 Organization: Sannas Consulting Message-ID: <9l7qon$d78$1@nntp9.atl.mindspring.net> NNTP-Posting-Host: d1.56.dc.82 X-Server-Date: 13 Aug 2001 06:06:15 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Xref: archiver1.google.com comp.lang.ada:11830 Date: 2001-08-13T06:06:15+00:00 List-Id: I'm still trying to get both lobes around the Ada paradigm. I have a record that I want to hold a pointer to a buffer which is either a String or Wide_String, but I don't want to statically declare which, so using a variant record won't work (at least given my understanding). Likewise, I don't want to have two record definitions, one for String, and one for Wide_String. In the package I'm designing, I don't care whether it is a String or Wide_String, I will just pass it to the file I/O packages (stream, in this case). In C, I would: struct { ULONG length; union { STRING_DESC *ansi_string; WIDE_STRING_DESC *wide_string; } strings; } string_desc; and then: struct { ... string_desc file_name; ... } some_struct; What is the idiom or method to use in Ada? -Brian