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-Thread: a07f3367d7,5a3e508f74e87110 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,CP1252 Path: g2news2.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!news.glorb.com!news2.glorb.com!de-l.enfer-du-nord.net!usenet-fr.net!ircam.fr!freenix!oleane.net!oleane!hunter.axlog.fr!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: Record representation : components order Date: Mon, 06 Jul 2009 10:07:10 +0200 Organization: Adalog Message-ID: References: <908a786e-214e-436f-868b-c0ead259fcc5@r33g2000yqn.googlegroups.com> NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Trace: s1.news.oleane.net 1246860624 26922 195.25.228.57 (6 Jul 2009 06:10:24 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Mon, 6 Jul 2009 06:10:24 +0000 (UTC) User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) In-Reply-To: Xref: g2news2.google.com comp.lang.ada:6855 Date: 2009-07-06T10:07:10+02:00 List-Id: Hibou57 (Yannick Duch�ne) a �crit : > Well, I've found an answer, buit this still leave me with a doubt. The > answer first, and the doubt next. > > An Ada-Auth discussion with a guy who has forgotten to apply pragma > Convention (C, ...) to the type of the member of a record (not exactly > the subject, while interesting), ends with these words : > > http://www.ada-auth.org/cgi-bin/cvsweb.cgi/acs/ac-00023.txt?rev=1.1 > says (at the end): >> Now when laying out type Time_Type, it uses textual order for >> the components (this is required by convention C). > > � required by convention C � : this is what one would expect indeed, > as I did, without beeing sure. But is it stated in the RM ? Annex B.1 > does not say such a thing. [...] >> C preserves the order of members within a struct and inserts padding >> so that members will be aligned on the machine-dependent proper >> address boundary for their type. > Now, since B.1(2) says: A pragma Convention is used to specify that an Ada entity should use the conventions of another language" you clearly have to look at the other language's standard to know the applicable convention. And there, you'll find that C requires to preserve order. Note that this is hinted by the end of the paragraph: For example, �pragma Convention(Fortran, Matrix);� implies that Matrix should be represented according to the conventions of the supported Fortran implementation, namely column-major order. Why doesn't the LRM say it clearly? Remember you never interface with another language, but with another compiler. And if the target C compiler does not implement the C standard correctly, the Ada compiler has to match the C compiler, not the C standard. -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr