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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!news-2.dfn.de!news.dfn.de!news.uni-weimar.de!not-for-mail From: stefan-lucks@see-the.signature Newsgroups: comp.lang.ada Subject: Re: ada commercial options Date: Thu, 21 Apr 2011 10:08:38 +0200 Organization: Bauhaus-Universitaet Weimar Message-ID: References: <5f171139-8296-4c7c-bc24-02885eadd260@dr5g2000vbb.googlegroups.com> <77c9c293-9fd3-4f3b-a754-83bf3d3be487@p16g2000vbi.googlegroups.com> Reply-To: stefan-lucks@see-the.signature NNTP-Posting-Host: medsec1.medien.uni-weimar.de Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: tigger.scc.uni-weimar.de 1303373172 18685 141.54.178.228 (21 Apr 2011 08:06:12 GMT) X-Complaints-To: news@tigger.scc.uni-weimar.de NNTP-Posting-Date: Thu, 21 Apr 2011 08:06:12 +0000 (UTC) X-X-Sender: lucks@medsec1.medien.uni-weimar.de In-Reply-To: Xref: g2news2.google.com comp.lang.ada:19911 Date: 2011-04-21T10:08:38+02:00 List-Id: 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. More precisely, Randy, could you give the authors of such libraries some hints how to write portable software, even without actually having access to another compiler? All the portability pitfalls I can think of are either easy to avoid, or should better be avoided for reasons beyond portability, anyway. (Except for dedicated low-level stuff, such as "with system;" and "Unchecked_Conversion".) 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.) 2. Avoid gnat-specific libraries. (The name of a package shows it: "gnat.something" is gnat-specific. Using packages from the Ada standard should be perfectly OK. Of course, some of the "gnat.something" packages are actually tempting ...) 3. Avoid constructs whose behavior is defined as implementation-defined by the Ada standard. (These should be avoided anyway, because the program behavior may not only change when the compiler changes, but also under a new version of the same compiler, or even with different optimization levels of the same version of the same compiler. Think of a program with several tasks and a race condition. The output may depend on which task does something first. Or think of "procedure P(V: in out T);" which, among other things, reads or writes X of type T. The semantics of "P(X);" has been left intentionally undefined by the Ada standard. ) 4. Don't assume a certain Size about system constants, such as Integer'Last. (Again, this is good advice, regardless of cross-compiler portability.) -- ------ Stefan Lucks -- Bauhaus-University Weimar -- Germany ------ Stefan dot Lucks at uni minus weimar dot de ------ I love the taste of Cryptanalysis in the morning! ------