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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,d8ff1403929a72c0 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.85.136 with SMTP id h8mr1769668paz.46.1344325002748; Tue, 07 Aug 2012 00:36:42 -0700 (PDT) Path: g9ni587715pbo.0!nntp.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!ctu-peer!ctu-gate!news.nctu.edu.tw!usenet.stanford.edu!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: awdorrin Newsgroups: comp.lang.ada Subject: Re: Interfacing between Ada and C: records and structs Date: Tue, 31 Jul 2012 12:08:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <296e271a-967b-4dfb-8dca-f278ecfae03d@googlegroups.com> <5813d3d2-8a9f-4a08-bf09-db3c62847593@googlegroups.com> NNTP-Posting-Host: 192.91.173.42 Mime-Version: 1.0 X-Trace: posting.google.com 1343761691 29688 127.0.0.1 (31 Jul 2012 19:08:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 31 Jul 2012 19:08:11 +0000 (UTC) In-Reply-To: <5813d3d2-8a9f-4a08-bf09-db3c62847593@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=192.91.173.42; posting-account=YkFdLgoAAADpWnfCBA6ZXMWTz2zHNd0j User-Agent: G2/1.0 X-Received-Bytes: 2282 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-07-31T12:08:10-07:00 List-Id: I am wondering if the Dummy element in the Mutex record is not being treated as a null, but as a null pointer, adding 8 bytes to the record size. I tried forcing the sizes to '192' in Ada by adding the rep spec and got the following error messages: size for "LOCK_SHM_1" too small, minimum allowed is 224 position of aliased field "LOCK_SHM_1" must be multiple of 64 bits So I'm guessing 192 (pthread_mutex_t) + 32 ( tagged null record) = 224 bits, rounded to 256 due to the address position requirement of an aliased field. (Still not sure I understand what a tagged or aliased field is, will have to read up on it.) So, I guess this turns out to be more of a C question - on if I can pad/align the structs via compiler flags, or if I am better off sticking with manually adding the padding. Not sure if there is a standard method used 'in modern times' to do this, other than defining a record in Ada and a corresponding struct in C.