comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve Doiel" <nospam_steved@pacifier.com>
Subject: Re: Ada95 Strengths/Weaknesses.
Date: 1999/09/28
Date: 1999-09-28T00:00:00+00:00	[thread overview]
Message-ID: <37f182d5.0@news.pacifier.com> (raw)
In-Reply-To: 7sqmk6$1ck3@drn.newsguy.com


<bill@yy> wrote in message news:7sqmk6$1ck3@drn.newsguy.com...
> In article <m3ogenur2s.fsf@kiuk0156.chembio.ntnu.no>, Preben says...
>
> >True. Most bugs are discovered _reading_ through the source code
> >rather than just testing the software.
>
> programmers reading the code?? This is a new one.
>
> seriously, one of the biggest problems I see is that many
> programmers do NOT read the code. They try something, it failes, jump
> into the debugger, set up a test, buy new hardware, hire more testers,
> run a profiler, etc.. they do all that, except actualy EXAMINE the code !

Actually I frequently print out and exammine source code.  Although I can
see your point.
When I learned FORTRAN we used keypunch machines and punch cards.  After
putting together our deck we submitted our programs for a batch run.  This
run might not be complete as long as 3 hours.  Sometimes I still amaze
myself at my ability to distinguish a zero from an "O" when reviewing code.

Along the same lines this is one of the reasons I prefer Ada.

Just today one of my co-workers was struggling with a bug in a C program and
asked for my assistance.  His program was transferring data from one array
to another:

  unsigned int idx;

  for( idx = beg; idx <= end; idx++ )
  {
    dest[ j++ ] := src[ idx ];
  }

He needed to change the loop to store the data in the opposite order, so he
changed the code to read:

  unsigned int idx;

  for( idx =end; idx >= beg; idx-- )
  {
    dest[ j++ ] := src[ idx ];
  }

And then spent a few hours trying to figure out why the program "locked up".

In case you missed it, when beg = 0, "idx >= beg" is always true for an
unsigned integer (idx) so he had an infinite loop.

Programmers are mortal.  Had this program been written in Ada he could have
spent these hours doing something productive.

  for idx in reverse beg .. endIdx loop
    dest( j ) := src( idx );
    j := j + 1;
  end loop;

BTW: There are loads of other tricky examples like this one.  This is just
one example of what I consider to be a strength of Ada when compared with C.

SteveD







  parent reply	other threads:[~1999-09-28  0:00 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-27  0:00 Ada95 Strengths/Weaknesses the middleman
1999-09-27  0:00 ` Steve Doiel
1999-09-27  0:00 ` J. David Bryan
1999-09-27  0:00 ` Marin David Condic
1999-09-27  0:00   ` Hyman Rosen
1999-09-28  0:00     ` Ed Falis
1999-09-28  0:00       ` Hyman Rosen
1999-09-28  0:00         ` Ed Falis
1999-09-28  0:00     ` Robert Dewar
1999-09-28  0:00       ` Preben Randhol
1999-09-28  0:00         ` bill
1999-09-27  0:00           ` Aidan Skinner
1999-09-28  0:00           ` Preben Randhol
1999-09-28  0:00           ` Steve Doiel [this message]
1999-09-28  0:00           ` Larry Kilgallen
1999-09-28  0:00   ` Preben Randhol
1999-09-27  0:00 ` David Starner
1999-09-28  0:00   ` the middleman
1999-09-28  0:00   ` Robert Dewar
1999-09-28  0:00     ` David Starner
1999-09-28  0:00       ` p.obry
1999-09-28  0:00         ` David Starner
1999-09-28  0:00           ` Richard D Riehle
1999-09-28  0:00       ` Gautier
1999-09-28  0:00         ` Ed Falis
1999-09-28  0:00           ` David Starner
1999-09-29  0:00           ` Robert Dewar
1999-09-28  0:00         ` David Starner
1999-09-29  0:00           ` Robert Dewar
1999-09-28  0:00       ` Ted Dennison
1999-09-28  0:00         ` Simon Wright
1999-09-28  0:00       ` Robert Dewar
1999-09-28  0:00       ` Robert Dewar
1999-09-28  0:00         ` David Starner
1999-09-29  0:00           ` Robert Dewar
1999-09-30  0:00         ` Pragma (was Re: Ada95 Strengths/Weaknesses.) Preben Randhol
1999-09-30  0:00           ` Preben Randhol
1999-09-28  0:00     ` Code size of Ada ? was Re: Ada95 Strengths/Weaknesses Alfred Hilscher
1999-09-28  0:00       ` David Botton
1999-09-28  0:00       ` Gautier
1999-09-29  0:00       ` Robert Dewar
1999-09-29  0:00         ` Larry Kilgallen
1999-09-29  0:00           ` Robert Dewar
1999-09-29  0:00           ` Alfred Hilscher
1999-09-29  0:00             ` Ted Dennison
1999-09-29  0:00             ` Gautier
1999-09-29  0:00               ` Ed Falis
1999-09-29  0:00                 ` Gautier
1999-09-29  0:00                 ` tmoran
1999-09-30  0:00               ` Robert Dewar
1999-09-29  0:00             ` Robert Dewar
1999-09-30  0:00               ` Alfred Hilscher
1999-09-30  0:00                 ` Robert Dewar
1999-09-30  0:00                   ` Ehud Lamm
1999-09-30  0:00                     ` Robert Dewar
     [not found]                       ` <7t2e1l$lqt2@ftp.kvaerner.com>
     [not found]                         ` <37F91D6E.58685CFE@mitre.org>
     [not found]                           ` <7tf7uo$h2b$1@nnrp1.deja.com>
     [not found]                             ` <37FBA978.A86762F1@mitre.org>
1999-10-18  0:00                               ` Robert Dewar
1999-10-19  0:00                                 ` Code size of Ada ? Robert I. Eachus
     [not found]                           ` <7tf7uo <37FBA978.A86762F1@mitre.org>
     [not found]                             ` <5OkO3.2$1e.659@typhoon.nyu.edu>
1999-10-19  0:00                               ` Code size of Ada ? was Re: Ada95 Strengths/Weaknesses Robert I. Eachus
1999-09-30  0:00                   ` tmoran
1999-09-30  0:00                 ` Gautier
1999-09-30  0:00                   ` Robert Dewar
1999-09-30  0:00                   ` Robert Dewar
1999-09-30  0:00                   ` Robert Dewar
1999-09-29  0:00           ` Robert Dewar
1999-09-29  0:00         ` Alfred Hilscher
1999-09-29  0:00           ` Robert Dewar
1999-09-30  0:00             ` Alfred Hilscher
1999-09-30  0:00               ` Gautier
1999-09-30  0:00               ` Robert Dewar
1999-09-28  0:00     ` GNAT listing file default names (was: Ada95 Strengths/Weaknesses) Larry Kilgallen
1999-09-28  0:00       ` Gautier
1999-09-29  0:00         ` Robert Dewar
1999-09-29  0:00       ` Robert Dewar
1999-09-29  0:00         ` Larry Kilgallen
1999-09-29  0:00           ` Robert Dewar
1999-09-29  0:00             ` Larry Kilgallen
1999-09-30  0:00               ` Robert Dewar
1999-09-28  0:00   ` Ada95 Strengths/Weaknesses Robert Dewar
1999-09-28  0:00     ` David Starner
1999-09-28  0:00       ` Robert Dewar
1999-09-28  0:00         ` Ray Blaak
1999-09-28  0:00     ` David Starner
1999-09-29  0:00       ` Robert A Duff
1999-09-28  0:00 ` Geoff Bull
1999-09-29  0:00   ` the middleman
1999-09-29  0:00     ` Robert A Duff
1999-09-28  0:00 ` Geoff Bull
replies disabled

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