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!z72g2000hsb.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada array vs C pointer (call by reference) Date: Fri, 27 Jun 2008 13:44:19 -0700 (PDT) Organization: http://groups.google.com Message-ID: <3dcc4a2d-f2f9-4c98-96c8-cd9dd1b090fe@z72g2000hsb.googlegroups.com> References: <5df91e99-a972-48f7-b466-3eb05dc0a915@m3g2000hsc.googlegroups.com> NNTP-Posting-Host: 85.3.103.34 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1214599459 20194 127.0.0.1 (27 Jun 2008 20:44:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 27 Jun 2008 20:44:19 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z72g2000hsb.googlegroups.com; posting-host=85.3.103.34; 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:921 Date: 2008-06-27T13:44:19-07:00 List-Id: 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? 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. How Ada implementation can guarantee anything in this area? > Look at it this way. You have the choice of using > Interfaces.C.C_Float, which (assuming the Ada implementation gets it > right), is guaranteed to match C's float There is no way to guarantee that. The only way is to name two compilers and say that *they* are compatible with this and that switches. But then - there is no added value from Interfaces.C.XXX. > Why would you even > consider using Float? Because the amount of magic and handwaving in interfacing is the same as with Interfaces.C.C_float, but it is less typing. :-) -- Maciej Sobczak * www.msobczak.com * www.inspirel.com