TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"W. Wesley Groleau x4923" <[log in to unmask]>
Fri, 9 Oct 1998 09:13:18 -0500
text/plain (39 lines)
>    strong typing
>    variant discriminated records
> means that if you make certain kinds of mistaker,  your program will
> not compile.  That means .... the Ada programmer will still be
> "fighting the compiler" ....

OTOH, IMHO, AFAIK, IANAL, ETC., if you've been programming in Ada or
another strongly-typed language for a while, you will likely have
consciously or unconsciously reduced your tendency (if any) to make those
kinds of careless mistakes.  In other words, many (not all) people with C
experience will "fight the compiler" far more when they first start in Ada
than after a few years at it.  And the reports by John McCormick and
Stephen Ziegler show that Ada reduces costs and defects (compared with C)
for even beginners in the language.

> -------------------------------------------------------------
> .... an individual .... did *not* know that Ada
> already does, in the language, checking for all of the assertions
> in the first 1/2 of his examples.  Nor that it does 7 of the 11 in the
> second set of examples.

Read "C Traps and Pitfalls" -- I only made it through the one-third of the
book, but if I remember right, all but two pages of that one-third covered
mistakes impossible in Ada.  The two pages was an incomprehensible (to me)
discussion of the subtle differences in behavior between several long
sequences of parentheses and asterisks.  My favorite "pitfall" was what
happens if you use the wrong one of the following two options:

   #define MAX = 100           #define MAX 100
   ....                        ....
   if (x=MAX)                  if (x=MAX)

(though I can't imagine why anyone would ever use the "right" one.)

Another thing that amazed me was reading "Elements of Programming Style"
from the '70s.  I kept wondering, "How could Kernighan work on this book,
then later work on one of the more popular books about a language opposed
to so much of it!?!?"