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!newsfeed2.dallas1.level3.net!news.level3.com!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: Fri, 27 Jun 2008 13:00:27 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <5df91e99-a972-48f7-b466-3eb05dc0a915@m3g2000hsc.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1214586028 9651 192.74.137.71 (27 Jun 2008 17:00:28 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 27 Jun 2008 17:00:28 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:kzdKmm8iNrDqWhdpmxH0U29Nllc= Xref: g2news1.google.com comp.lang.ada:915 Date: 2008-06-27T13:00:27-04:00 List-Id: Keith Thompson writes: > Interfaces.C.C_Float, which (assuming the Ada implementation gets it > right), is guaranteed to match C's float, or of using Float, which has > no such guarantee (but saves a little typing). Why would you even > consider using Float? You might have a program that uses Float all over the place, and you want to add some interface to C in one tiny corner of that program. You might be tempted to use Float at the interface to C in order to avoid a lot of type conversions. It's a pretty good bet that Ada's Float and Ada's Interfaces.C.C_Float, and C's float are all represented the same. If you're using GNAT, I think the documentation guarantees that. But you're right -- the "right" way to interface to C is to use the types in Interfaces.C, and use pragma Convention when you declare your own types. - Bob