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!postnews.google.com!d19g2000prm.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Ada array vs C pointer (call by reference) Date: Fri, 27 Jun 2008 15:36:32 -0700 (PDT) Organization: http://groups.google.com Message-ID: <44b654da-5a19-4230-a5f2-94e35f2b3aeb@d19g2000prm.googlegroups.com> References: <5df91e99-a972-48f7-b466-3eb05dc0a915@m3g2000hsc.googlegroups.com> <3dcc4a2d-f2f9-4c98-96c8-cd9dd1b090fe@z72g2000hsb.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1214606193 6959 127.0.0.1 (27 Jun 2008 22:36:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 27 Jun 2008 22:36:33 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d19g2000prm.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:926 Date: 2008-06-27T15:36:32-07:00 List-Id: On Jun 27, 3:14 pm, Keith Thompson wrote: > Maciej Sobczak writes: > > On 27 Cze, 18:11, Keith Thompson wrote: > > > > Ada *cannot* guarantee that Interfaces.C.C_Float is the *right* float, > > > > because it does not verify how the C code was compiled and there is a > > > > lot of freedom given to C implementers in this area. > > > > Same for all other types. > > > > 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? > > It doesn't *mandate* the representation used by the C compiler; the > author of the Interfaces.C implementation has to *know* the > representation used by the C compiler. Which is, of course, impossible without a crystal ball. Anyway, I don't see anything in the RM that makes any such requirement. The language involved uses a lot of "corresponds to" phrasing, which I think is deliberately fuzzy enough to avoid *requiring* an Ada implementation to do something that cannot realistically be done in a guaranteed manner. I think the idea is that the implementor is just expected to define the types in a way that is probably going to make things work right. That's about as strong a statement as one can make. But, of course, it's still different from the standard Ada types like Integer and Float; there are no such expectations put on Ada implementations that the type representations correspond at all to C types. -- Adam