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,ddf5660e3e8010b1 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!news.in2p3.fr!in2p3.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!jacob-sparre.dk!ada-dk.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: ada commercial options Date: Thu, 21 Apr 2011 18:42:50 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <5f171139-8296-4c7c-bc24-02885eadd260@dr5g2000vbb.googlegroups.com> <77c9c293-9fd3-4f3b-a754-83bf3d3be487@p16g2000vbi.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1303429373 19222 69.95.181.76 (21 Apr 2011 23:42:53 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 21 Apr 2011 23:42:53 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-RFC2646: Format=Flowed; Original Xref: g2news1.google.com comp.lang.ada:18971 Date: 2011-04-21T18:42:50-05:00 List-Id: wrote in message news:Pine.LNX.4.64.1104210935070.1184@medsec1.medien.uni-weimar.de... > On Wed, 20 Apr 2011, Randy Brukardt wrote: > >> The vast majority of "libraries" written for GNAT aren't portable enough >> to >> use on other compilers, even if they only use Ada 95 features. In my >> opinion, a library isn't portable unless it is compiled on at least two >> different Ada compilers. > > Randy, could you describe which portability issues with real-world > libraries you know? Dedicated low-level stuff is hard to write portably, > but it seems to me that Ada actually makes it easy to write portable > general-purpose libraries. Tero got a lot of them. ... > 1. Avoid gnat-specific pragmas and attributes. E.g., write > "Type'Image(Variable)" instead of "Variable'Img". > > (The gnat documentation is quite clear about what is gnat-specific, so > this should be easy for any library author who cares a little bit about > portability.) One thing that will help a lot is the new Ada 2012 profile "No_Implementation_Extensions", which will prevent using any implementation-defined pragmas, attributes, aspects, withing any such packages, and using implementation-defined things allowed in the standard library. That gets a lot of it right there. Some of these exist as restrictions pragmas in Ada 2005 (No_Implementation_Pragmas and No_Implementation_Attributes). > 2. Avoid gnat-specific libraries. This also is caught by the above profile. What is nice about this is it will flag things like implementation-defined containers (probably found under Ada.Containers -- the language encourages such additions, but of course they hurt portability). > 3. Avoid constructs whose behavior is defined as implementation-defined > by the Ada standard. This is the hard one, and it is rarely done. Probably because it is virtually impossible to avoid such things (specifically, the range of Integer, the order that parameters are evaluated), and it is also very hard to detect them. > 4. Don't assume a certain Size about system constants, such as > Integer'Last. Right. I think you got most of the high points. The new profile will help, because it will at least eliminate all of the obvious non-portabilities. (I've often found uses of 'Unrestricted_Access in code I've tried to use, barf.) Randy.