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,d71460587da14d5b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-31 03:52:22 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!diablo.theplanet.net!newspeer1-gui.server.ntli.net!ntli.net!newsfep4-glfd.server.ntli.net.POSTED!53ab2750!not-for-mail From: chris User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Importing C structs? References: <6RYVa.16208$It4.10081@rwcrnsc51.ops.asp.att.net> In-Reply-To: <6RYVa.16208$It4.10081@rwcrnsc51.ops.asp.att.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Thu, 31 Jul 2003 11:53:51 +0100 NNTP-Posting-Host: 81.98.236.164 X-Complaints-To: abuse@ntlworld.com X-Trace: newsfep4-glfd.server.ntli.net 1059648740 81.98.236.164 (Thu, 31 Jul 2003 11:52:20 BST) NNTP-Posting-Date: Thu, 31 Jul 2003 11:52:20 BST Organization: ntl Cablemodem News Service Xref: archiver1.google.com comp.lang.ada:41068 Date: 2003-07-31T11:53:51+01:00 List-Id: tmoran@acm.org wrote: > > This is wrong. The C has > > >> union { >> int i[8]; >> char s[JMSG_STR_PARM_MAX]; >> } msg_parm; > > which means msg_parm is JMSG_STR_PARM_MAX number of bytes, interpretable > sometimes as a char array and sometimes as an int array followed by > filler. msg_parm is never an address. To match the C, I suggest making > msg_parm an interfaces.c.char_array (the larger of the two objects), > and then doing an unchecked_conversion on those (relatively rare) > occasions when you need to treat it as an array of int's. Yeah I knew that was wrong, I just didn't know what to map a union to and hadn't fixed it yet... thanks for the example! Thanks, Chris