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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6b77ce1ba18f9267 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-07 08:03:49 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn14feed!wn12feed!worldnet.att.net!205.188.226.97!ngpeer.news.aol.com!cyclone1.gnilink.net!spamfinder.gnilink.net!nwrddc02.gnilink.net.POSTED!53ab2750!not-for-mail From: "Frank J. Lhota" Newsgroups: comp.lang.ada References: <3dca4583$0$299$bed64819@news.gradwell.net> Subject: Re: Import a type from C X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: Date: Thu, 07 Nov 2002 16:03:48 GMT NNTP-Posting-Host: 141.157.181.57 X-Complaints-To: abuse@verizon.net X-Trace: nwrddc02.gnilink.net 1036685028 141.157.181.57 (Thu, 07 Nov 2002 11:03:48 EST) NNTP-Posting-Date: Thu, 07 Nov 2002 11:03:48 EST Xref: archiver1.google.com comp.lang.ada:30543 Date: 2002-11-07T16:03:48+00:00 List-Id: Thinking over my previous experience with this type of work, I would go with the advice of using a representation clause. In general, a representation clause should be used whenever a type cooresponds to data external to the Ada program. This eliminates any concern about how this or that compiler lays out a record. Ada programmers are blessed with the whole chapter 13 support. C / C++ has only the crude pack pragma / command line option to control the layout of a struct. Is there any C compiler that automatically generates a decription of how it lays out a struct? If I declare typedef struct tag_mydata { char lead; long total; unsigned year : 12; unsigned month : 4; unsigned day : 5; } mydata; is there a C compiler that has a command line option that will generate a listing that shows the byte offset of the total member from the start of a "mydata" struct, or the location of the bits that make up the month member? Neither gcc nor MSVC++ has such an option, which would make this work much easier.