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: 103376,5a84d5077c54a29d X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!news-xxxfer.readnews.com!news-out.readnews.com!postnews3.readnews.com!not-for-mail Date: Fri, 27 Jun 2008 20:56:38 -0400 From: "Peter C. Chapin" User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada array vs C pointer (call by reference) References: <5df91e99-a972-48f7-b466-3eb05dc0a915@m3g2000hsc.googlegroups.com> <3dcc4a2d-f2f9-4c98-96c8-cd9dd1b090fe@z72g2000hsb.googlegroups.com> In-Reply-To: <3dcc4a2d-f2f9-4c98-96c8-cd9dd1b090fe@z72g2000hsb.googlegroups.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <48658c46$0$2689$4d3efbfe@news.sover.net> Organization: SoVerNet (sover.net) NNTP-Posting-Host: f36b5e72.news.sover.net X-Trace: DXC=jolA[[2CijV:Z]K:CilNaSK6_LM2JZB_S@>hFf=`MTVQ:WUUlR<856_A?;:]BGHViRhm8[8goLZ]U X-Complaints-To: abuse@sover.net X-Original-Bytes: 2489 Xref: g2news1.google.com comp.lang.ada:929 Date: 2008-06-27T20:56:38-04:00 List-Id: 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