comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Record representation : components order
Date: Mon, 06 Jul 2009 03:29:08 -0400
Date: 2009-07-06T03:29:08-04:00	[thread overview]
Message-ID: <uk52m6zi3.fsf@stephe-leake.org> (raw)
In-Reply-To: fe5c021f-bb6a-466f-b5ec-00ceb94661ae@32g2000yqj.googlegroups.com

"Hibou57 (Yannick Duchêne)" <yannick_duchene@yahoo.fr> writes:

> 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. With the guy (the one who opended the
> thread), I agree than some more extensive wording would be required to
> fullfill the wish that it is possible to do things in Ada without
> relying on a particular compiler's behaviour.

That's what record representation clauses are for.

> Perhaps it is informally clear to someone, so that is has been left
> from the standard (when a thing is obvious to someone, it is easy to
> forget to point it).

No, the meaning of "convention C" is deliberately left implementation
defined, so that any given Ada compiler vendor can match any given C
compiler.

> N.B. pragma Convention is required when the C specs make use of some
> type whose size depends on some configuration. This is not convenient
> to use “ at range ” in this case. This is the reason of this thread.

Can you elaborate? I don't understand why you can't use a record
representation clause.

Hmm. Perhaps you have a C compiler that allows you to specify the size
of "int" or some other C type via a command line switch or some other
mechanism. To accomodate that in Ada, you'd need to use different
files, selected by a build switch. It's not the same mechanism, but
it's not very hard, either.

-- 
-- Stephe



  parent reply	other threads:[~2009-07-06  7:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-04 21:08 Record representation : components order Hibou57 (Yannick Duchêne)
2009-07-05  3:14 ` Hibou57 (Yannick Duchêne)
2009-07-05 10:16   ` sjw
2009-07-06  7:33     ` Stephen Leake
2009-07-07 19:37       ` sjw
2009-07-09  9:28         ` Stephen Leake
2009-07-09 19:16           ` sjw
2009-07-10  5:26             ` Stephen Leake
2009-07-06  7:29   ` Stephen Leake [this message]
2009-07-06  8:07   ` Jean-Pierre Rosen
2009-07-05 14:10 ` Stephen Leake
2009-07-06  2:57   ` Hibou57 (Yannick Duchêne)
2009-07-06  8:27     ` Jacob Sparre Andersen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox