* Re: ada commercial options
2011-04-21 8:08 ` stefan-lucks
@ 2011-04-21 9:37 ` Tero Koskinen
2011-04-21 19:58 ` Pascal Obry
` (2 subsequent siblings)
3 siblings, 0 replies; 16+ messages in thread
From: Tero Koskinen @ 2011-04-21 9:37 UTC (permalink / raw)
stefan-lucks@see-the.signature wrote:
> 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.
I am not Randy, but I have developed my portable unit testing library
Ahven since 2007 and made it work on at least 4 different compiler
families:
- GNAT (Ada 2005 mode),
- Janus/Ada (Ada 95 mode),
- Irvine ICCAda (Ada 2005 mode),
- ObjectAda (Ada 95 mode).
In addition, most of my non-avr Ada code found from
https://bitbucket.org/tkoskine/ is tested with above compilers.
Issues which I usually run into are:
1. Compiler bugs
- usually some compiler either doesn't understand the used syntax,
crashes when parses the code, generates invalid code, or
has a bug in its runtime.
- from the above group, Janus/Ada is probably the "most buggiest"
compiler, but others have their share also.
(And even though I think the Janus/Ada being on top here, I
still recommend it if one needs a cheap commercial Ada compiler
for personal use.)
- especially FSF GNAT seems to be plaqued by regressions,
for example FSF GCC 4.5 cannot compile Ahven at all
(versions 4.[2346] are ok).
- I could say that my Ahven library is a real compiler bug magnet.
Even though all the code is plain Ada 95 and the line count
is only around 2K-3K, I still "all the time" hit into really
interesting bugs, which one would have though being fixed many
years ago. (I think the rate is around one compiler bug per month,
for those months when I have time to do development.)
2. Performance differences
- Unbounded_String performance varies a lot between compilers.
One compiler can be 10 times faster than another.
3. Implementation status
- Compiler doesn't implement some more or less optional feature.
(This is probably more issue with Ada 2005 than Ada 95.)
4. Compilers warn about different things
- You cannot compile code in warnings=errors mode on all compilers
at the same time.
> 4. Don't assume a certain Size about system constants, such as
> Integer'Last.
This bit me recently. Even though I knew that Integer is only
16 bit long in Janus/Ada, I didn't take into account that the maximum
size of Unbounded_String is also limited by the size of Integer.
In other words, you can store only 32 Kbytes to Unbounded_String.
--
Tero Koskinen - http://iki.fi/tero.koskinen/
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: ada commercial options
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 19:58 ` Pascal Obry
2011-04-21 23:42 ` Randy Brukardt
3 siblings, 1 reply; 16+ messages in thread
From: Pascal Obry @ 2011-04-21 19:58 UTC (permalink / raw)
To: stefan-lucks
Le 21/04/2011 10:08, stefan-lucks@see-the.signature a �crit :
> 1. Avoid gnat-specific pragmas and attributes. E.g., write
> "Type'Image(Variable)" instead of "Variable'Img".
Ok.
> 2. Avoid gnat-specific libraries.
That's not a problem. At some point AWS was compiled under GNAT and
Aonix compiler. I had just copied some GNAT packages (GNAT.Regexp, and
some others) from GNAT and compiled them with Aonix compiler.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net - http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: ada commercial options
2011-04-21 19:58 ` Pascal Obry
@ 2011-04-21 21:13 ` Georg Bauhaus
2011-04-21 21:19 ` Pascal Obry
0 siblings, 1 reply; 16+ messages in thread
From: Georg Bauhaus @ 2011-04-21 21:13 UTC (permalink / raw)
On 4/21/11 9:58 PM, Pascal Obry wrote:
> Le 21/04/2011 10:08, stefan-lucks@see-the.signature a �crit :
>> 2. Avoid gnat-specific libraries.
>
> That's not a problem. At some point AWS was compiled under GNAT and
> Aonix compiler. I had just copied some GNAT packages (GNAT.Regexp, and
> some others) from GNAT and compiled them with Aonix compiler.
Since these libraries aren't GNAT specific, then,
would it be o.K. to place them in a subsystem
whose name sounds a little less GNAT specific? :-)
Like PAL, or GNU, or ...
(Other GNAT.* packages really are GNAT specific in that
they use implementation defined attributes, for example,
and cannot be compiled with other Ada compilers.)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: ada commercial options
2011-04-21 21:13 ` Georg Bauhaus
@ 2011-04-21 21:19 ` Pascal Obry
0 siblings, 0 replies; 16+ messages in thread
From: Pascal Obry @ 2011-04-21 21:19 UTC (permalink / raw)
To: Georg Bauhaus
Le 21/04/2011 23:13, Georg Bauhaus a �crit :
> Since these libraries aren't GNAT specific, then,
> would it be o.K. to place them in a subsystem
> whose name sounds a little less GNAT specific? :-)
>
> Like PAL, or GNU, or ...
GNAT had been chosen no need to change that. It means that it has been
implemented for GNAT and not part of the standard. That's why it is not
under Ada.
> (Other GNAT.* packages really are GNAT specific in that
> they use implementation defined attributes, for example,
> and cannot be compiled with other Ada compilers.)
Many GNAT.* packages are not GNAT specific, or if they are it is
probably easy to fix I think. AFAIR it was quite easy when I did that
for AWS.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net - http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: ada commercial options
2011-04-21 8:08 ` stefan-lucks
2011-04-21 9:37 ` Tero Koskinen
2011-04-21 19:58 ` Pascal Obry
@ 2011-04-21 19:58 ` Pascal Obry
2011-04-21 23:42 ` Randy Brukardt
3 siblings, 0 replies; 16+ messages in thread
From: Pascal Obry @ 2011-04-21 19:58 UTC (permalink / raw)
To: stefan-lucks
Le 21/04/2011 10:08, stefan-lucks@see-the.signature a �crit :
> 1. Avoid gnat-specific pragmas and attributes. E.g., write
> "Type'Image(Variable)" instead of "Variable'Img".
Ok.
> 2. Avoid gnat-specific libraries.
That's not a problem. At some point AWS was compiled under GNAT and
Aonix compiler. I had just copied some GNAT packages (GNAT.Regexp, and
some others) from GNAT and compiled them with Aonix compiler.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net - http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: ada commercial options
2011-04-21 8:08 ` stefan-lucks
` (2 preceding siblings ...)
2011-04-21 19:58 ` Pascal Obry
@ 2011-04-21 23:42 ` Randy Brukardt
2011-04-22 5:55 ` Simon Wright
3 siblings, 1 reply; 16+ messages in thread
From: Randy Brukardt @ 2011-04-21 23:42 UTC (permalink / raw)
<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.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: ada commercial options
2011-04-21 23:42 ` Randy Brukardt
@ 2011-04-22 5:55 ` Simon Wright
2011-04-23 0:50 ` Randy Brukardt
0 siblings, 1 reply; 16+ messages in thread
From: Simon Wright @ 2011-04-22 5:55 UTC (permalink / raw)
"Randy Brukardt" <randy@rrsoftware.com> writes:
>> 2. Avoid gnat-specific libraries.
>
> This also is caught by the above profile.
Unless a compiler has a special "don't allow 'with GNAT'" rule, I don't
see how it can do this?
Or is it that vendors are expected to disallow use of their own
non-standard libraries?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: ada commercial options
2011-04-22 5:55 ` Simon Wright
@ 2011-04-23 0:50 ` Randy Brukardt
0 siblings, 0 replies; 16+ messages in thread
From: Randy Brukardt @ 2011-04-23 0:50 UTC (permalink / raw)
"Simon Wright" <simon@pushface.org> wrote in message
news:m2zknivnht.fsf@pushface.org...
> "Randy Brukardt" <randy@rrsoftware.com> writes:
>
>>> 2. Avoid gnat-specific libraries.
>>
>> This also is caught by the above profile.
>
> Unless a compiler has a special "don't allow 'with GNAT'" rule, I don't
> see how it can do this?
>
> Or is it that vendors are expected to disallow use of their own
> non-standard libraries?
The restriction only applies to children of the language defined packages,
since things like "with GNAT" are trivial to find and eliminate. Children of
Ada, System, and Interfaces are difficult to tell language-defined ones from
implementation-defined ones (especially as we keep adding them in each new
language version - an Ada 95 program depending on
Ada.Containers.Multiway_Trees is looking for trouble).
But for children of the language-defined packages, the answer is yes, they
are supposed to disallow (when the restriction is present) use of their own
non-standard libraries. That's the whole point.
Randy.
^ permalink raw reply [flat|nested] 16+ messages in thread