comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Ada array vs C pointer (call by reference)
Date: Sat, 28 Jun 2008 13:44:53 -0400
Date: 2008-06-28T13:44:53-04:00	[thread overview]
Message-ID: <wcczlp5pi7e.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 3dcc4a2d-f2f9-4c98-96c8-cd9dd1b090fe@z72g2000hsb.googlegroups.com

Maciej Sobczak <see.my.homepage@gmail.com> writes:

> And how the implementation can guarantee it without mandating the
> representation on the C compiler?

The idea is that the Ada compiler writer chooses a particular
implementation of C, and supports interfacing to that.
No need to "mandate" -- just write the Ada compiler so it
mimics what that particular C compiler does.  And then the
Ada compiler writer writes documentation "this Ada implementation
supports interface to the Mumble C compiler, version 1.2.3".
The Ada implementation could support intefacing with multiple C
implementations, but if the Ada implementation claims to support
interfacing to C, it has to support at least one.

> Consider a C compiler that has a switch that selects the
> representation for fundamental types. It is not uncommon.
> I can have *the same* program compiled twice by *the same* compiler
> and the two versions will differ in representation of their
> fundamental types.

That's conceptually two (or more) C implementations.  The Ada compiler
writer would document the switches that must be used on the C side.
Or maybe there would be similar switches on the Ada side,
and the documentation would require them to match.

> How Ada implementation can guarantee anything in this area?

An Ada implementation guarantees that Interfaces.C.C_Float matches the
representation of float chosen by a particular C implementation, such as
version 1.2.3 of the Mumble C compiler.  Not so hard.  And quite
useful.

- Bob



  parent reply	other threads:[~2008-06-28 17:44 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
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 [this message]
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