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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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!postnews.google.com!59g2000hsb.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada array vs C pointer (call by reference) Date: Sat, 28 Jun 2008 07:11:33 -0700 (PDT) Organization: http://groups.google.com Message-ID: <72661814-9e6e-40bb-a013-ad3b5c7217dc@59g2000hsb.googlegroups.com> References: <5df91e99-a972-48f7-b466-3eb05dc0a915@m3g2000hsc.googlegroups.com> <3dcc4a2d-f2f9-4c98-96c8-cd9dd1b090fe@z72g2000hsb.googlegroups.com> <48658c46$0$2689$4d3efbfe@news.sover.net> NNTP-Posting-Host: 85.3.215.245 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1214662294 2101 127.0.0.1 (28 Jun 2008 14:11:34 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 28 Jun 2008 14:11:34 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 59g2000hsb.googlegroups.com; posting-host=85.3.215.245; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:937 Date: 2008-06-28T07:11:33-07:00 List-Id: On 28 Cze, 02:56, "Peter C. Chapin" wrote: > 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). This is exactly my point. We have to rely on some external knowledge, which is provided by compiler vendors. Or sometimes by just old good common sense. In any case, there is nothing related to "portability" in Interfaces.C. The types defined there are exactly as non-portable (as far as interfacing is concerned) as any other type in Ada, because the other side is a moving target. And if some vendor gives guarantees about any type, these guarantees are out of scope of AARM and can be also given to types from other packages, including Standard. Actually, I'd expect a quality vendor to document everything - and it is the documentation that tells me what is compatible for interfacing and what is not. There is of course some added value in Interface.C.XXX - it is documenting the intent. If I see something like: procedure Foo (X : in Interfaces.C.int); then I understand that the intent is to interface with some C code. I will also expect some pragma Import/Export in the next line, and so on - this is exactly the purpose of documenting the intent. I might not have the same understanding with Integer as the parameter type, even though there is nothing technical that guarantees compatibility with Interfaces.C.int or prohibits it with Integer. > 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. Yes. > Furthermore if I then move my > Ada/C program to another Ada/C compiler suite, I would expect it to > continue to work Yes, but it has nothing to do with Interfaces.C itself - it is only the matter of how the Ada/C "suite" is documented, because depending on which types you focus on, you will get different compiler pairs in the set. -- Maciej Sobczak * www.msobczak.com * www.inspirel.com