comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada array vs C pointer (call by reference)
Date: Tue, 1 Jul 2008 16:19:34 -0500
Date: 2008-07-01T16:19:34-05:00	[thread overview]
Message-ID: <g4e71j$6dh$1@jacob-sparre.dk> (raw)
In-Reply-To: e2c1ab35-55c8-4873-afcd-ee27bdbbd36a@i36g2000prf.googlegroups.com

"Adam Beneschan" <adam@irvine.com> wrote in message 
news:e2c1ab35-55c8-4873-afcd-ee27bdbbd36a@i36g2000prf.googlegroups.com...
...
>Some people seem to think the Ada compiler will
> know how the C compiler works, and some seem to go far enough to say
> that the Ada compiler should be able to *guarantee* that types in
> Interfaces.C will have the same representation, and that the RM
> requires this.

Well, it intends to require it for a specific C compiler implementations. 
But that intent only occurs in the AARM (see B.2(13.a-b)).

For a specific implementation (which might include particular compiler 
switches), the intent is that the types are correct.

But of course, this is all Implementation Advice (there would be no 
normative way to say this), so implementations are free to ignore it.


> ... My
> interpretation is that an Ada compiler vendor should know what the
> data representations are for the *typical* C compiler used in the
> typical fashion on that system (which may well be a C compiler made
> available by the same vendor, or a related one), and should make
> things so that Interfaces.C will work with that.  But since there's no
> guarantee that any particular object file or library will have been
> compiled with that C compiler, that's the most any Ada compiler can
> do.

That is definitely *not* the intent: see B.2(13.a-b). But I think that is 
how most implementers have interpreted the intent, because it's easier to do 
that making a separate package for every version of every supported 
compiler. (Remember, since the intent is Advice, implementers are not wrong 
in ignoring it.)

...
>> This whole argument started because somebody wanted to use Float instead
>> of C_Float.  But there is nothing in the Ada RM saying that Float should
>> correspond to anything in particular.  There IS something in the RM
>> saying that C_Float corresponds to float as implemented by the C
>> compiler(s) that the Ada compiler claims to support interfacing to.
>> And the Ada compiler documentation will tell you which C compiler(s)
>> are supported.
>
> Yeah, I think those last two sentences are the key here.

Surely.

                           Randy.





  parent reply	other threads:[~2008-07-01 21:19 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-27  1:39 Ada array vs C pointer (call by reference) Adrian Hoe
2008-06-27  1:42 ` Adrian Hoe
2008-06-27  2:55 ` Adam Beneschan
2008-06-27 13:02   ` Maciej Sobczak
2008-06-27 13:15     ` Adrian Hoe
2008-06-27 14:43     ` Georg Bauhaus
2008-06-27 14:47       ` Georg Bauhaus
2008-06-27 20:35       ` Maciej Sobczak
2008-06-27 22:00         ` Georg Bauhaus
2008-06-27 22:46           ` Keith Thompson
2008-06-27 16:11     ` Keith Thompson
2008-06-27 17:00       ` Robert A Duff
2008-06-27 18:15         ` Keith Thompson
2008-06-28 14:02         ` Stephen Leake
2008-06-28 21:18           ` Keith Thompson
2008-07-03 12:44         ` Rob Norris
2008-06-27 20:44       ` Maciej Sobczak
2008-06-27 22:14         ` Keith Thompson
2008-06-27 22:36           ` Adam Beneschan
2008-06-28 14:04             ` Stephen Leake
2008-06-28 21:22               ` Keith Thompson
2008-06-30 17:13               ` Adam Beneschan
2008-06-28 17:52             ` Robert A Duff
2008-06-30 17:13               ` Adam Beneschan
2008-06-30 18:55                 ` Robert A Duff
2008-07-01 21:19                 ` Randy Brukardt [this message]
2008-07-01 21:19                 ` Randy Brukardt
2008-06-28  0:56         ` Peter C. Chapin
2008-06-28 14:11           ` Maciej Sobczak
2008-06-28 17:49             ` tmoran
2008-06-28 21:46             ` Keith Thompson
2008-06-28 17:44         ` Robert A Duff
2008-07-01 21:10       ` Randy Brukardt
2008-06-27 18:13     ` tmoran
2008-06-27 20:49       ` Maciej Sobczak
2008-06-27  4:10 ` Jeffrey R. Carter
2008-06-27  8:22   ` Adrian Hoe
2008-06-27 15:07     ` Adam Beneschan
2008-06-27 22:54     ` Jeffrey R. Carter
2008-06-28  1:15       ` Adrian Hoe
2008-06-28  2:17         ` Adam Beneschan
2008-07-01 21:31           ` Randy Brukardt
2008-07-01 21:31           ` Randy Brukardt
2008-08-22  4:06           ` Adrian Hoe
2008-06-28  4:59         ` Jeffrey R. Carter
2008-06-29  3:48         ` anon
2008-06-28  1:21 ` anon
replies disabled

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