comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter C. Chapin" <pchapin@sover.net>
Subject: Re: Ada array vs C pointer (call by reference)
Date: Fri, 27 Jun 2008 20:56:38 -0400
Date: 2008-06-27T20:56:38-04:00	[thread overview]
Message-ID: <48658c46$0$2689$4d3efbfe@news.sover.net> (raw)
In-Reply-To: <3dcc4a2d-f2f9-4c98-96c8-cd9dd1b090fe@z72g2000hsb.googlegroups.com>

Maciej Sobczak wrote:

>> No, Ada can't guarantee it directly.  Instead, Ada requires the
>> implementation to guarantee it.
> 
> And how the implementation can guarantee it without mandating the
> representation on the C compiler?

My understanding is that the interfacing to C is only really meaningful 
if the Ada compiler is in some way associated with a corresponding C 
compiler (for example, created by the same vendor). In such a case, the 
Ada side selects appropriate types in Interfaces.C to match the types 
used by the *associated* C compiler. If the C compiler supports multiple 
representations of its basic types, well, that's interesting... the Ada 
side could do the same (compiler option?). The point is that the two 
compilers are working together.

I never assumed that Interfaces.C could somehow magically allow any Ada 
compiler to work with any C compiler. I'm surprised that some people 
seem to expect that. However, when I call C code compiled with gcc using 
GNAT, I would expect Interfaces.C to specify the right types because gcc 
and GNAT are closely related compilers. Furthermore if I then move my 
Ada/C program to another Ada/C compiler suite, I would expect it to 
continue to work (if I'm using Interfaces.C properly, etc, of course).

Peter



  parent reply	other threads:[~2008-06-28  0:56 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
2008-07-01 21:19                 ` Randy Brukardt
2008-06-28  0:56         ` Peter C. Chapin [this message]
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