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!news2.google.com!news.glorb.com!nlpi057.nbdc.sbc.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Ada array vs C pointer (call by reference) Date: Sat, 28 Jun 2008 13:44:53 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <5df91e99-a972-48f7-b466-3eb05dc0a915@m3g2000hsc.googlegroups.com> <3dcc4a2d-f2f9-4c98-96c8-cd9dd1b090fe@z72g2000hsb.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1214675094 31985 192.74.137.71 (28 Jun 2008 17:44:54 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sat, 28 Jun 2008 17:44:54 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:4NWFSecvd8rLdv9zp/ba3dkc33c= Xref: g2news1.google.com comp.lang.ada:938 Date: 2008-06-28T13:44:53-04:00 List-Id: Maciej Sobczak 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