comp.lang.ada
 help / color / mirror / Atom feed
* New to Ada, why these warning messages?
@ 2016-01-01  2:19 Dale Dellutri
  2016-01-01  2:47 ` David Botton
                   ` (3 more replies)
  0 siblings, 4 replies; 26+ messages in thread
From: Dale Dellutri @ 2016-01-01  2:19 UTC (permalink / raw)


I'm trying to compile and run the following program:
-- from: http://sandbox.mc.edu/~bennet/ada/examples/arr2_adb.html
-- Array aggregates.  Array aggregates are essentially constants of
-- array type.  They can be used either for initialization or in
-- assignment statements.
--
with Gnat.Io; use Gnat.Io;
procedure Gnatarr2 is
   -- Just some values to play with, along with a conversion array.
   type Paint is (Red, Green, Yellow, Blue, Pink, Orange, Mauve,
                  Cherry, Indigo, Brown);
   PNames: array(Paint) of String(1..6) :=
     ("Red   ", "Green ", "Yellow", "Blue  ", "Pink  ", "Orange", 
"Mauve ",
      "Cherry", "Indigo", "Brown ");

   -- The type of an array of paints, along with its size.
   N: constant := 8;
   type AType is array(Integer range 1..N) of Paint;

   -- Some Paint arrays.  The first one is initialized with a list
   -- of colors.
   A: AType := (Red, Red, Pink, Blue, Orange, Cherry, Indigo, Indigo);
   B, C: AType;

   I: Integer;          -- Loop index.

begin

   -- Use positions to set varioius values in various places.
   B := (5 => Green, 2 => Orange, 6..8 => Indigo, 1|3|4 => Brown);

   -- Set the entire array to Blue.
   C := (AType'First .. AType'Last => Blue);

   -- Print the position numbers, spaced out to align with the
   -- the printouts of each of the arrays below.
   for I in 1..N loop
      Put("  ");
      Put(I);
      Put("    ");
   end loop;
   New_Line;

   -- Print out the contents of each of A, B, and C.
   for I in 1..N loop
      Put(PNames(A(I)) & " ");
   end loop;
   New_Line;

   for I in 1..N loop
      Put(PNames(B(I)) & " ");
   end loop;
   New_Line;

   for I in 1..N loop
      Put(PNames(C(I)) & " ");
   end loop;
   New_Line;
end Gnatarr2;

I'm using gcc-gnat on Fedora 22 (I changed the name of
the file from arr2.adb to gnatarr2.adb and also the name
of the unit to Gnatarr2):

$ gnatmake src/gnatarr2.adb -o bin/gnatarr2
gcc -c -Isrc/ -I- src/gnatarr2.adb
gnatarr2.adb:24:04: warning: variable "I" is never read and never 
assigned
gnatarr2.adb:54:08: warning: for loop implicitly declares loop 
variable
gnatarr2.adb:54:08: warning: declaration hides "I" declared at line 24
gnatbind -x gnatarr2.ali
gnatlink gnatarr2.ali -o bin/gnatarr2

Of course, these are only warnings, and the unit compiles and runs.

If I comment out the defintion of I: Integer;, I get:

$ gnatmake src/gnatarr2.adb -o bin/gnatarr2
gcc -c -Isrc/ -I- src/gnatarr2.adb
gnatbind -x gnatarr2.ali
gnatlink gnatarr2.ali -o bin/gnatarr2

In this case, I assume it's using an implicit defintion of I.

But I do not understand the warning messages.  What's wrong with
the definition of I: Integer; on line 24?

-- 
Dale Dellutri <daQQQle@panQQQix.com> (lose the Q's)

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-01  2:19 New to Ada, why these warning messages? Dale Dellutri
@ 2016-01-01  2:47 ` David Botton
  2016-01-01  5:54 ` Jeffrey R. Carter
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 26+ messages in thread
From: David Botton @ 2016-01-01  2:47 UTC (permalink / raw)


> gnatarr2.adb:24:04: warning: variable "I" is never read and never 
> assigned

Correct the I in line 24 at the procedure scope is neve used

> gnatarr2.adb:54:08: warning: for loop implicitly declares loop 
> variable

In Ada when you use for the var you choose is local to the for loop

> gnatarr2.adb:54:08: warning: declaration hides "I" declared at line 24

So this new I hides the I in line 24 and the compiler is helping you to understand this.

> But I do not understand the warning messages.  What's wrong with
> the definition of I: Integer; on line 24?

Nothing you just never use it only the brand new I in your for loop.

David Botton

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-01  2:19 New to Ada, why these warning messages? Dale Dellutri
  2016-01-01  2:47 ` David Botton
@ 2016-01-01  5:54 ` Jeffrey R. Carter
  2016-01-01 21:18   ` Bob Duff
  2016-01-01 17:30 ` Dennis Lee Bieber
  2016-01-01 20:20 ` Dale Dellutri
  3 siblings, 1 reply; 26+ messages in thread
From: Jeffrey R. Carter @ 2016-01-01  5:54 UTC (permalink / raw)


Botton explained the warnings you got, but a larger issue is that this is poor
Ada and so not the best thing to be learning from.

On 12/31/2015 07:19 PM, Dale Dellutri wrote:
> 
>    -- Some Paint arrays.  The first one is initialized with a list
>    -- of colors.
>    A: AType := (Red, Red, Pink, Blue, Orange, Cherry, Indigo, Indigo);

This is not a list. It's a positional array aggregate.

>    I: Integer;          -- Loop index.

As you've discovered, this is not the loop index. Loop indices are declared by
the loop, are constant within the loop, and cease to exist when the loop is
exited. Whoever wrote this was probably used to languages in which you had to
declare a loop index like this, and hadn't learned how Ada works.

>    -- Use positions to set varioius values in various places.
>    B := (5 => Green, 2 => Orange, 6..8 => Indigo, 1|3|4 => Brown);

This is a named array aggregate.

>    -- Set the entire array to Blue.
>    C := (AType'First .. AType'Last => Blue);

This would be better written

   (Atype'range => Blue)

or

   (Paint => Blue)

>    -- Print the position numbers, spaced out to align with the
>    -- the printouts of each of the arrays below.
>    for I in 1..N loop

I would probably use

   for I in Atype'range loop

to avoid using a "magic number", even in a case like this in which it's unlikely
that a change to the constant won't also result in a change to the array range.

>    -- Print out the contents of each of A, B, and C.
>    for I in 1..N loop

   for I in A'range loop

>       Put(PNames(A(I)) & " ");
> 
>    for I in 1..N loop

   for I in B'range loop

>       Put(PNames(B(I)) & " ");
> 
>    for I in 1..N loop

   for I in C'range loop

>       Put(PNames(C(I)) & " ");

Tying the loop index to the array using 'range makes it easier for the compiler
to optimize away bounds checks.

-- 
Jeff Carter
"Strange women lying in ponds distributing swords
is no basis for a system of government."
Monty Python & the Holy Grail
66

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-01  2:19 New to Ada, why these warning messages? Dale Dellutri
  2016-01-01  2:47 ` David Botton
  2016-01-01  5:54 ` Jeffrey R. Carter
@ 2016-01-01 17:30 ` Dennis Lee Bieber
  2016-01-01 20:20 ` Dale Dellutri
  3 siblings, 0 replies; 26+ messages in thread
From: Dennis Lee Bieber @ 2016-01-01 17:30 UTC (permalink / raw)


On Fri, 1 Jan 2016 02:19:41 +0000 (UTC), Dale Dellutri
<daQQQle@panQQQix.com> declaimed the following:

>   PNames: array(Paint) of String(1..6) :=
>     ("Red   ", "Green ", "Yellow", "Blue  ", "Pink  ", "Orange", 
>"Mauve ",
>      "Cherry", "Indigo", "Brown ");
>

	Why?


>   for I in 1..N loop

	Ada FOR loop index variables are automatically declared and typed to
match the range provided. Which, as others have mentioned, should really be
defined as the 'range of the type, not some magic numbers.

	And that IS what the error messages were telling you...

>gnatarr2.adb:54:08: warning: for loop implicitly declares loop 
>variable
>gnatarr2.adb:54:08: warning: declaration hides "I" declared at line 24

>      Put(PNames(A(I)) & " ");

	Without actually coding it, I'd think this could be replaced by

	put(Paint'Image(A(i)) & " ");

meaning no need for the additional pnames array.


Okay...  'Image needs work for the alignment
C:\Users\Wulfraed\Ada\GnatArr
  1      2      3      4      5      6      7      8    
RED RED PINK BLUE ORANGE CHERRY INDIGO INDIGO 
BROWN ORANGE BROWN BROWN GREEN INDIGO INDIGO INDIGO 
BLUE BLUE BLUE BLUE BLUE BLUE BLUE BLUE 

[2016-01-01 12:24:35] process terminated successfully, elapsed time: 00.18s

with GNAT.IO; use GNAT.IO;
procedure Gnatarr is
   -- Just some values to play with, along with a conversion array.
   type Paint is
     (Red, Green, Yellow, Blue, Pink, Orange, Mauve, Cherry, Indigo,
Brown);

   -- The type of an array of paints, along with its size.
   N : constant := 8;
   type AType is array (Integer range 1 .. N) of Paint;

   -- Some Paint arrays.  The first one is initialized with a list
   -- of colors.
   A    : AType := (Red, Red, Pink, Blue, Orange, Cherry, Indigo, Indigo);
   B, C : AType;

begin

   -- Use positions to set various values in various places.
   B := (5 => Green, 2 => Orange, 6 .. 8 => Indigo, 1 | 3 | 4 => Brown);

   -- Set the entire array to Blue.
   C := (others => Blue);

   -- Print the position numbers, spaced out to align with the
   -- the printouts of each of the arrays below.
   for I in AType'Range loop
      Put ("  ");
      Put (I);
      Put ("    ");
   end loop;
   New_Line;

   -- Print out the contents of each of A, B, and C.
   for I in AType'Range loop
      Put (Paint'Image (A (I)) & " ");
   end loop;
   New_Line;

   for I in AType'Range loop
      Put (Paint'Image (B (I)) & " ");
   end loop;
   New_Line;

   for I in AType'Range loop
      Put (Paint'Image (C (I)) & " ");
   end loop;
   New_Line;
end Gnatarr;
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-01  2:19 New to Ada, why these warning messages? Dale Dellutri
                   ` (2 preceding siblings ...)
  2016-01-01 17:30 ` Dennis Lee Bieber
@ 2016-01-01 20:20 ` Dale Dellutri
  2016-01-01 21:24   ` Bob Duff
                     ` (2 more replies)
  3 siblings, 3 replies; 26+ messages in thread
From: Dale Dellutri @ 2016-01-01 20:20 UTC (permalink / raw)


On Thu, 31 Dec 2015 21:19:41, Dale Dellutri <dale@panix.com> wrote:
> I'm trying to compile and run the following program:
> -- from: http://sandbox.mc.edu/~bennet/ada/examples/arr2_adb.html

Thanks for all who responded.  I now understand the warning messages.

Now I need to find a better source for Ada program examples.
Any ideas?

Also, a good first Ada book?

I found "Programming in Ada 2012" by John Barnes.  It's rather
large.  I was hoping for something like "The C Programming
Language, 2nd edition" by Kernighan and Ritchie.  Is there
anything that concise?

(My goal is to determine whether it would be better to convert
a large cache of Fortran 95 programs to C or Ada.  I already
know the problems converting to C.  I need to convert some
Fortran programs to Ada to determine what problems might occur.)

-- 
Dale Dellutri <dale@panix.com>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-01  5:54 ` Jeffrey R. Carter
@ 2016-01-01 21:18   ` Bob Duff
  0 siblings, 0 replies; 26+ messages in thread
From: Bob Duff @ 2016-01-01 21:18 UTC (permalink / raw)


"Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> writes:

> This would be better written
>
>    (Atype'range => Blue)
>
> or
>
>    (Paint => Blue)

Even better:

    C := (others => Blue);

>>    -- Print out the contents of each of A, B, and C.
>>    for I in 1..N loop
>
>    for I in A'range loop
>
>>       Put(PNames(A(I)) & " ");

In Ada 2012 you can say:

    for X of A loop
        Put(PNames(X) & " ");

That's better, because it leaves out the extraneous object I,
which has nothing to do with the problem being solved.

- Bob

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-01 20:20 ` Dale Dellutri
@ 2016-01-01 21:24   ` Bob Duff
  2016-01-01 21:54     ` Dale Dellutri
  2016-01-01 23:50   ` Jeffrey R. Carter
  2016-01-02 17:59   ` Dennis Lee Bieber
  2 siblings, 1 reply; 26+ messages in thread
From: Bob Duff @ 2016-01-01 21:24 UTC (permalink / raw)


Dale Dellutri <dale@panix.com> writes:

> (My goal is to determine whether it would be better to convert
> a large cache of Fortran 95 programs to C or Ada.  I already
> know the problems converting to C.  I need to convert some
> Fortran programs to Ada to determine what problems might occur.)

Why would you convert a Fortran program to something else?
I mean, unless it's totally broken or impossible to maintain or
something, that's likely to be a waste of money.

- Bob


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-01 21:24   ` Bob Duff
@ 2016-01-01 21:54     ` Dale Dellutri
  2016-01-02 12:45       ` Simon Clubley
  0 siblings, 1 reply; 26+ messages in thread
From: Dale Dellutri @ 2016-01-01 21:54 UTC (permalink / raw)


On Fri, 01 Jan 2016 16:24:03, Bob Duff <bobduff@theworld.com> wrote:
> Dale Dellutri <dale@panix.com> writes:
> 
>> (My goal is to determine whether it would be better to convert
>> a large cache of Fortran 95 programs to C or Ada.  I already
>> know the problems converting to C.  I need to convert some
>> Fortran programs to Ada to determine what problems might occur.)
> 
> Why would you convert a Fortran program to something else?
> I mean, unless it's totally broken or impossible to maintain or
> something, that's likely to be a waste of money.

We have been told that programming in Fortran is old-fashioned.
I don't agree, but there are other considerations, I'm told.

Of course it's a waste of time and money.  Despite that, it's
happening.

-- 
Dale Dellutri <daQQQle@panQQQix.com> (lose the Q's)

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-01 20:20 ` Dale Dellutri
  2016-01-01 21:24   ` Bob Duff
@ 2016-01-01 23:50   ` Jeffrey R. Carter
  2016-01-02 21:05     ` Bob Duff
  2016-01-02 17:59   ` Dennis Lee Bieber
  2 siblings, 1 reply; 26+ messages in thread
From: Jeffrey R. Carter @ 2016-01-01 23:50 UTC (permalink / raw)


On 01/01/2016 01:20 PM, Dale Dellutri wrote:
> 
> Also, a good first Ada book?
> 
> I found "Programming in Ada 2012" by John Barnes.  It's rather
> large.  I was hoping for something like "The C Programming
> Language, 2nd edition" by Kernighan and Ritchie.  Is there
> anything that concise?

Barnes is good and very comprehensive, if expensive and heavy. Since you have
programming experience , I recommend /Ada Distilled/, available at

http://www.adaic.org/learn/materials/

specifically,

http://www.adaic.org/wp-content/uploads/2010/05/Ada-Distilled-24-January-2011-Ada-2005-Version.pdf

It's for ISO/IEC 8652:2007, but if you need Ada 12 it's easy enough to pick up
the new stuff. Rumor has it there's an Ada-12 version coming soon.

> (My goal is to determine whether it would be better to convert
> a large cache of Fortran 95 programs to C or Ada.  I already
> know the problems converting to C.  I need to convert some
> Fortran programs to Ada to determine what problems might occur.)

We have hard data across multiple application domains showing that deployed C
has 4 times the errors of deployed Ada. I'm not aware of any data for Ada
compared to Fortran, but I wouldn't be surprised if Ada has an edge there, too.
So if this is a cost-plus DoD project doing this to drive up costs through
unnecessary work, converting to C is the way to go. Where correctness is
tantamount, Ada is the language of choice.

-- 
Jeff Carter
"Run away! Run away!"
Monty Python and the Holy Grail
58


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-01 21:54     ` Dale Dellutri
@ 2016-01-02 12:45       ` Simon Clubley
  2016-01-02 14:21         ` Britt
  2016-01-03  7:11         ` J-P. Rosen
  0 siblings, 2 replies; 26+ messages in thread
From: Simon Clubley @ 2016-01-02 12:45 UTC (permalink / raw)


On 2016-01-01, Dale Dellutri <daQQQle@panQQQix.com> wrote:
>
> We have been told that programming in Fortran is old-fashioned.
> I don't agree, but there are other considerations, I'm told.
>

It's nice to see Ada being considered, but there's one thing I need
to ask: Which Ada compiler and operating system are you using ?

If you are using the Ada compiler in the FSF version of gcc, then
the following isn't a problem.

If however you are using the Ada compiler which is freely downloadable
from the ACT website, you should be aware that any executables you
create using that compiler are covered by the GPL and hence so is any
source code used to create those executables.

The FSF version of gcc has a runtime exception in the licence which
means that using the Ada RTL doesn't cause the resulting executable to
become a GPL based executable. The free Ada compiler from the ACT
website does not have this exception even though it is also gcc based.

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-02 12:45       ` Simon Clubley
@ 2016-01-02 14:21         ` Britt
  2016-01-02 15:29           ` Simon Clubley
  2016-01-03  7:11         ` J-P. Rosen
  1 sibling, 1 reply; 26+ messages in thread
From: Britt @ 2016-01-02 14:21 UTC (permalink / raw)


On Saturday, January 2, 2016 at 7:48:19 AM UTC-5, Simon Clubley wrote:

> If however you are using the Ada compiler which is freely downloadable
> from the ACT website, you .....
 
Why do you keep referring to AdaCore as ACT? They officially changed their company name over a decade ago so continuing to use either "ACT" or "Ada Core Technologies" will just confuse new users.

-Britt


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-02 14:21         ` Britt
@ 2016-01-02 15:29           ` Simon Clubley
  0 siblings, 0 replies; 26+ messages in thread
From: Simon Clubley @ 2016-01-02 15:29 UTC (permalink / raw)


On 2016-01-02, Britt <britt.snodgrass@gmail.com> wrote:
> On Saturday, January 2, 2016 at 7:48:19 AM UTC-5, Simon Clubley wrote:
>
>> If however you are using the Ada compiler which is freely downloadable
>> from the ACT website, you .....
>  
> Why do you keep referring to AdaCore as ACT? They officially changed their company name over a decade ago so continuing to use either "ACT" or "Ada Core Technologies" will just confuse new users.
>

I keep referring to AdaCore as ACT because that's how I knew them when
I first started to become interested in Ada. I'm also used to people
referring to the same entities/technologies by different names as things
change over the years.

However, your point is taken. I'll try to remember to just use AdaCore
from now on.

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-01 20:20 ` Dale Dellutri
  2016-01-01 21:24   ` Bob Duff
  2016-01-01 23:50   ` Jeffrey R. Carter
@ 2016-01-02 17:59   ` Dennis Lee Bieber
  2016-01-02 18:37     ` Paul Rubin
  2016-01-02 21:08     ` Bob Duff
  2 siblings, 2 replies; 26+ messages in thread
From: Dennis Lee Bieber @ 2016-01-02 17:59 UTC (permalink / raw)


On Fri, 1 Jan 2016 20:20:29 +0000 (UTC), Dale Dellutri <dale@panix.com>
declaimed the following:

>
>I found "Programming in Ada 2012" by John Barnes.  It's rather
>large.  I was hoping for something like "The C Programming
>Language, 2nd edition" by Kernighan and Ritchie.  Is there
>anything that concise?
>
	Uhm... In terms of size the only things I'm familiar with would not be
Ada... (The Python Language Reference Manual used to run around 90 pages,
though if one includes the Library Reference Manual one might get closer to
the Ada books; closer to Ada would be the document for the language the
four teams started development from: Pascal User Manual and Report -- which
may give you an idea of how much stuff Ada added over Pascal, and why the
books are so thick).

	Converting from that level of Pascal to Ada is almost trivial... But
takes no advantage of anything developed after the 70s <G>

>(My goal is to determine whether it would be better to convert
>a large cache of Fortran 95 programs to C or Ada.  I already
>know the problems converting to C.  I need to convert some
>Fortran programs to Ada to determine what problems might occur.)

	Well... If the F95 code is really using the F95 features (in
particular, modules) I suspect Ada packages will be a better fit than
anything in common C.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-02 17:59   ` Dennis Lee Bieber
@ 2016-01-02 18:37     ` Paul Rubin
  2016-01-02 21:03       ` Bob Duff
  2016-01-02 21:08     ` Bob Duff
  1 sibling, 1 reply; 26+ messages in thread
From: Paul Rubin @ 2016-01-02 18:37 UTC (permalink / raw)


Dennis Lee Bieber <wlfraed@ix.netcom.com> writes:
> -- which may give you an idea of how much stuff Ada added over Pascal,
> and why the books are so thick).

Is there a summary somewhere of what Ada added to Pascal?  I also
haven't understood why the books are so thick, or why Ada has such a
reputation of being hard to compile.  Any simple summary?  Thanks!


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-02 18:37     ` Paul Rubin
@ 2016-01-02 21:03       ` Bob Duff
  0 siblings, 0 replies; 26+ messages in thread
From: Bob Duff @ 2016-01-02 21:03 UTC (permalink / raw)


Paul Rubin <no.email@nospam.invalid> writes:

> Is there a summary somewhere of what Ada added to Pascal?

Mike Woodger told me that chapters 2-6 were supposed to be
(very roughly) the Pascal subset of Ada, and chapters 7-14
were the new stuff.  That's for Ada 83 -- since then, various
things have been added, such as object-oriented features in
chapter 3, which doesn't correspond to Pascal.  I'm talking
about Jensen and Wirth Pascal, not Delphi or other dialects.

Off the top of my head, features in Ada 83 but not Pascal: a more
elaborate type system, dynamic arrays, discriminant-dependent arrays,
bounds are not part of array type, slices, fixed-point types,
user-defined numeric types, aggregates, full coverage rules, better
notion of parameter modes (especially: pass-by-reference allowed for
'in' parameters), packages, private types, limited types, renaming,
multi-tasking, separate compilation(!), generics, representation
clauses, most of the pragmas and attributes.

The AARM has a list at the end of each section of features added since
Ada 83.

>...I also
> haven't understood why the books are so thick, or why Ada has such a
> reputation of being hard to compile.  Any simple summary?  Thanks!

No simple summary.  Ada is a big language, and it's hard to implement.
Other languages are worse in that regard, though -- C++ comes to mind.

If you read the Ada RM (preferably the Annotated version -- AARM), you
will see.  Or for just a taste, read section 3.10.2, and think about how
to implement it.  ;-)

- Bob


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-01 23:50   ` Jeffrey R. Carter
@ 2016-01-02 21:05     ` Bob Duff
  2016-01-02 22:53       ` Jeffrey R. Carter
  0 siblings, 1 reply; 26+ messages in thread
From: Bob Duff @ 2016-01-02 21:05 UTC (permalink / raw)


"Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> writes:

> We have hard data across multiple application domains showing that deployed C
> has 4 times the errors of deployed Ada.

Do you have a cite for that?  (I know about the Steve Ziegler paper.)

- Bob


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-02 17:59   ` Dennis Lee Bieber
  2016-01-02 18:37     ` Paul Rubin
@ 2016-01-02 21:08     ` Bob Duff
  1 sibling, 0 replies; 26+ messages in thread
From: Bob Duff @ 2016-01-02 21:08 UTC (permalink / raw)


Dennis Lee Bieber <wlfraed@ix.netcom.com> writes:

>...Pascal User Manual and Report

By Jensen and Wirth.

>... -- which
> may give you an idea of how much stuff Ada added over Pascal, and why the
> books are so thick).

Yes, but another reason for the size difference is that the
above-mentioned Pascal book is rather informal (to put it politely).
The Ada RM actually tries to get all the details nailed down
correctly (and mostly succeeds).

- Bob

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-02 21:05     ` Bob Duff
@ 2016-01-02 22:53       ` Jeffrey R. Carter
  0 siblings, 0 replies; 26+ messages in thread
From: Jeffrey R. Carter @ 2016-01-02 22:53 UTC (permalink / raw)


On 01/02/2016 02:05 PM, Bob Duff wrote:
> "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org> writes:
> 
>> We have hard data across multiple application domains showing that deployed C
>> has 4 times the errors of deployed Ada.
> 
> Do you have a cite for that?  (I know about the Steve Ziegler paper.)

There's Ziegler's paper, which you know about, at

http://archive.adaic.com/intro/ada-vs-c/cada_art.html#xtocid153455

(for those who don't know about it) and there was a posting here on c.l.a by
Marin Condic about jet-engine control S/W at Pratt & Whitney that reported
similar results; about 4 times the errors and about 10 times the effort per
error was the average I took away from those.

Some would also cite McCormick's real-time course results for this, but while it
clearly shows reduction in development effort for Ada compared to C, since no
one ever finished the project in C, I can't see that it provides any information
on error rates. Information about it is at

http://static1.1.sqspcdn.com/static/f/702523/9458053/1290008042427/200008-McCormick.pdf?token=C60YTOwv6V6y%2BJDCChhjKp2Vp4U%3D

for those not familiar with it.

-- 
Jeff Carter
"If I could find a sheriff who so offends the citizens of Rock
Ridge that his very appearance would drive them out of town ...
but where would I find such a man? Why am I asking you?"
Blazing Saddles
37


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-02 12:45       ` Simon Clubley
  2016-01-02 14:21         ` Britt
@ 2016-01-03  7:11         ` J-P. Rosen
  2016-01-03  9:32           ` Simon Wright
  2016-01-03  9:59           ` Simon Clubley
  1 sibling, 2 replies; 26+ messages in thread
From: J-P. Rosen @ 2016-01-03  7:11 UTC (permalink / raw)


Le 02/01/2016 13:45, Simon Clubley a écrit :
> If however you are using the Ada compiler which is freely downloadable
> from the ACT website, you should be aware that any executables you
> create using that compiler are covered by the GPL and hence so is any
> source code used to create those executables.
> 
It is true that code compiled with Ada GPL is covered by the GPL, but
this does NOT extend to the source code. The author of a program ALLWAYS
keeps full rights (whether GPL or any other license).

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-03  7:11         ` J-P. Rosen
@ 2016-01-03  9:32           ` Simon Wright
  2016-01-03  9:59           ` Simon Clubley
  1 sibling, 0 replies; 26+ messages in thread
From: Simon Wright @ 2016-01-03  9:32 UTC (permalink / raw)


"J-P. Rosen" <rosen@adalog.fr> writes:

> Le 02/01/2016 13:45, Simon Clubley a écrit :
>> If however you are using the Ada compiler which is freely downloadable
>> from the ACT website, you should be aware that any executables you
>> create using that compiler are covered by the GPL and hence so is any
>> source code used to create those executables.
>> 
> It is true that code compiled with Ada GPL is covered by the GPL, but
> this does NOT extend to the source code. The author of a program ALLWAYS
> keeps full rights (whether GPL or any other license).

To be strict, I believe that it's code [compiled against and] linked
with the GPL *RTS* that's covered by the full GPL.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-03  7:11         ` J-P. Rosen
  2016-01-03  9:32           ` Simon Wright
@ 2016-01-03  9:59           ` Simon Clubley
  2016-01-03 14:23             ` David Botton
  2016-01-03 15:48             ` J-P. Rosen
  1 sibling, 2 replies; 26+ messages in thread
From: Simon Clubley @ 2016-01-03  9:59 UTC (permalink / raw)


On 2016-01-03, J-P. Rosen <rosen@adalog.fr> wrote:
> Le 02/01/2016 13:45, Simon Clubley a écrit :
>> If however you are using the Ada compiler which is freely downloadable
>> from the ACT website, you should be aware that any executables you
>> create using that compiler are covered by the GPL and hence so is any
>> source code used to create those executables.
>> 
> It is true that code compiled with Ada GPL is covered by the GPL, but
> this does NOT extend to the source code. The author of a program ALLWAYS
> keeps full rights (whether GPL or any other license).
>

So are you saying that if:

a) Someone uses the Adacore GPL compiler to create an executable without
realising that the _output_ from that compiler is also covered by the
GPL (because the compiler has included code from the GNAT RTL) and

b) then distributes that executable (for example, by placing it on a website)

then the author isn't required to provide the source code to anyone
using the executable who asks for the source code ?

If so, that's contrary to everything I know about the GPL.

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-03  9:59           ` Simon Clubley
@ 2016-01-03 14:23             ` David Botton
  2016-01-03 15:48             ` J-P. Rosen
  1 sibling, 0 replies; 26+ messages in thread
From: David Botton @ 2016-01-03 14:23 UTC (permalink / raw)


> then the author isn't required to provide the source code to anyone
> using the executable who asks for the source code ?

Nope you have to distribute your source code in such a case.

Of course don't forget the famous scare tactic phrase from AdaCore's site regarding GNAT: "Most important you should ascertain the license and IPR (Intellectual Property Rights) guarantees from its provider."

The FSF GNAT is owned by the FSF and any IPR assigned to them, GNAT GPL is an AdaCore product and in theory they can make IPR claims as well, so unless you purchase their support contracts and get a guarantee of IPR release from them I would not use any AdaCore product even GNAT GPL.

If you want to use GNAT you should stick to FSF GNAT versions only for production systems - http://getadanow.com

David Botton


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-03  9:59           ` Simon Clubley
  2016-01-03 14:23             ` David Botton
@ 2016-01-03 15:48             ` J-P. Rosen
  2016-01-03 18:03               ` David Botton
  1 sibling, 1 reply; 26+ messages in thread
From: J-P. Rosen @ 2016-01-03 15:48 UTC (permalink / raw)


Le 03/01/2016 10:59, Simon Clubley a écrit :
>> It is true that code compiled with Ada GPL is covered by the GPL, but
>> > this does NOT extend to the source code. The author of a program ALLWAYS
>> > keeps full rights (whether GPL or any other license).
>> >
> So are you saying that if:
> 
> a) Someone uses the Adacore GPL compiler to create an executable without
> realising that the _output_ from that compiler is also covered by the
> GPL (because the compiler has included code from the GNAT RTL) and
> 
> b) then distributes that executable (for example, by placing it on a website)
> 
> then the author isn't required to provide the source code to anyone
> using the executable who asks for the source code ?
> 
> If so, that's contrary to everything I know about the GPL.
Not at all. I'm saying that the author keeps his rights on the source,
so it's OK if:
a) someone compiles the code with GNAT and distributes it under the GPL
b) compiles it with a different compiler and distributes it under a
propriatory license

The author is bound to the GPL for the first distribution, but not for
the second one.

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-03 15:48             ` J-P. Rosen
@ 2016-01-03 18:03               ` David Botton
  2016-01-03 18:20                 ` Pascal Obry
  0 siblings, 1 reply; 26+ messages in thread
From: David Botton @ 2016-01-03 18:03 UTC (permalink / raw)



> The author is bound to the GPL for the first distribution, but not for
> the second one.

Which means that anyone that has had access to that executable has the right to ask for the source from the original distribution and effectively only your new additions/changes can remain hidden from the GPL virus.

The OP's point was valid, once you release a software compiled with a GPL runtime (spit twice in the direction of the hideous foul beast of abuse) you are bound for all of history to make all the source from the exe available.

True it doesn't "change" the original license but it overrides that snapshot and that is just about the same thing practically.

David Botton

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-03 18:03               ` David Botton
@ 2016-01-03 18:20                 ` Pascal Obry
  2016-01-03 19:05                   ` David Botton
  0 siblings, 1 reply; 26+ messages in thread
From: Pascal Obry @ 2016-01-03 18:20 UTC (permalink / raw)


Le dimanche 03 janvier 2016 à 10:03 -0800, David Botton a écrit :
> Which means that anyone that has had access to that executable has
> the right to ask for the source from the original distribution and
> effectively only your new additions/changes can remain hidden from
> the GPL virus.

Call it virus if you like. I see it as the best way to keep the ball
rolling. Without the GPL we certainly won't have so many nice piece of
software around... Everybody will try to redo whatever seems cool to
make money, and won't have the ressource to make something decent. Look
at GNOME, KDE, Inkscape... sorry I won't list the many thousands of
softwares that make my work possible.

To me it is not a virus it was and is a chance for humanity.

-- 
  Pascal Obry /  Magny Les Hameaux (78)

  The best way to travel is by means of imagination

  http://v2p.fr.eu.org
  http://www.obry.net

  gpg --keyserver keys.gnupg.net --recv-key F949BD3B


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: New to Ada, why these warning messages?
  2016-01-03 18:20                 ` Pascal Obry
@ 2016-01-03 19:05                   ` David Botton
  0 siblings, 0 replies; 26+ messages in thread
From: David Botton @ 2016-01-03 19:05 UTC (permalink / raw)


> Call it virus if you like. I see it as the best way to keep the ball
> rolling.

Not for runtimes which is what we are discussing. On runtimes it removes freedoms and destroys innovation. The FSF compilers from the GPL people don't use stright GPL for a reason. It has been extremely harmful and destructive to the Ada community, the Eiffel community and others where the GPL was used as license virus to prevent compiler use and community innovation.

> Without the GPL we certainly won't have so many nice piece of
> software around...

If GCC had been distributed with a GPL runtime then we would have absolutely nothing now.

> Everybody will try to redo whatever seems cool to
> make money, and won't have the ressource to make something decent. Look
> at GNOME, KDE, Inkscape... sorry I won't list the many thousands of
> softwares that make my work possible.

And when a company abuses the GPL on runtimes to restrict freedoms they are the opposite of open source proponents.

Almost all my code for the last 12 years has been released under GPL or with exceptions. I think you are barking up the wrong tree trying to convince me of benefits of GPL on non-runtime projects.
 
> To me it is not a virus it was and is a chance for humanity.

No, it is a virus on runtimes. It is intended to prevent innovation, prevent use of the compiler by others, it is everything most of the open source movement has fought to make possible.

It is a dirty virus on runtimes meant to harm.

David Botton

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2016-01-03 19:05 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-01  2:19 New to Ada, why these warning messages? Dale Dellutri
2016-01-01  2:47 ` David Botton
2016-01-01  5:54 ` Jeffrey R. Carter
2016-01-01 21:18   ` Bob Duff
2016-01-01 17:30 ` Dennis Lee Bieber
2016-01-01 20:20 ` Dale Dellutri
2016-01-01 21:24   ` Bob Duff
2016-01-01 21:54     ` Dale Dellutri
2016-01-02 12:45       ` Simon Clubley
2016-01-02 14:21         ` Britt
2016-01-02 15:29           ` Simon Clubley
2016-01-03  7:11         ` J-P. Rosen
2016-01-03  9:32           ` Simon Wright
2016-01-03  9:59           ` Simon Clubley
2016-01-03 14:23             ` David Botton
2016-01-03 15:48             ` J-P. Rosen
2016-01-03 18:03               ` David Botton
2016-01-03 18:20                 ` Pascal Obry
2016-01-03 19:05                   ` David Botton
2016-01-01 23:50   ` Jeffrey R. Carter
2016-01-02 21:05     ` Bob Duff
2016-01-02 22:53       ` Jeffrey R. Carter
2016-01-02 17:59   ` Dennis Lee Bieber
2016-01-02 18:37     ` Paul Rubin
2016-01-02 21:03       ` Bob Duff
2016-01-02 21:08     ` Bob Duff

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