comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: ada commercial options
Date: Thu, 21 Apr 2011 18:42:50 -0500
Date: 2011-04-21T18:42:50-05:00	[thread overview]
Message-ID: <ioqfdt$iom$1@munin.nbi.dk> (raw)
In-Reply-To: Pine.LNX.4.64.1104210935070.1184@medsec1.medien.uni-weimar.de

<stefan-lucks@see-the.signature> 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.





  parent reply	other threads:[~2011-04-21 23:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-18 18:21 ada commercial options tonyg
2011-04-18 18:49 ` Vinzent Hoefler
2011-04-18 19:59   ` Georg Bauhaus
2011-04-19  7:37   ` Maciej Sobczak
2011-04-20 23:24     ` Randy Brukardt
2011-04-21  6:18       ` Maciej Sobczak
2011-04-21  8:08       ` stefan-lucks
2011-04-21  9:37         ` Tero Koskinen
2011-04-21 19:58         ` Pascal Obry
2011-04-21 21:13           ` Georg Bauhaus
2011-04-21 21:19             ` Pascal Obry
2011-04-21 19:58         ` Pascal Obry
2011-04-21 23:42         ` Randy Brukardt [this message]
2011-04-22  5:55           ` Simon Wright
2011-04-23  0:50             ` Randy Brukardt
2011-04-21 20:16   ` Nicholas Collin Paul Gloucester
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox