comp.lang.ada
 help / color / mirror / Atom feed
From: billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu (William Thomas Wolfe, 2847 )
Subject: Re: problems/risks due to programming language
Date: 21 Feb 90 20:15:56 GMT	[thread overview]
Message-ID: <8103@hubcap.clemson.edu> (raw)
In-Reply-To: 5432@crdgw1.crd.ge.com

From hammondr@sunroof.crd.ge.com (Richard A Hammond):
>>     3. The AT&T breakdown a month ago was caused by a break statement
>>	in C. See the following mail (multiple forwarding headers deleted):
> 
>>| | In the switching software (written in C), there was a long
>>| | "do . . . while" construct, which contained
>>| |    a "switch" statement, which contained 
>>| |       an "if" clause, which contained a
>>| |          "break," which was intended for
>>| |       the "if" clause, but instead broke from
>>| |    the "switch" statement.
>>| | 
>>
>>	Again it looks like this bug wouldn't have occurred in another
>>	programming language.
% 
% What other programming language?  Only one without any GOTO or restricted
% GOTO (e.g. exit, break, ...).  This leaves out Ada!!!!!!
% 
%  [...]  for N in 1 .. MAX loop 
% 	    case ...
% 	    when ... =>
%                 if NEW_ITEMS(N) = FALSE then 
% 			-- some other useful work gets done here
%                         exit; 			-- exits loop, not if!
%                 end if; 
% 	    when ... =>
%   [...] 
% So, in the AT&T case using Ada we would have exited both the switch and the
% loop rather than just the switch.  Hardly an improvement!

   This is not a valid analogy.  In C, the case statement *requires* the
   use of a restricted GOTO in order to accomplish "normal" processing;
   at the end of the section of code processing a given case, one must
   use a restricted GOTO in order to prevent C from sending the flow of
   control straight into the section of code which was intended to process
   the NEXT case.  In other words, C requires the programmer to use a
   dangerous construct on a routine basis.

   With the if construct in C, the default is to exit the if construct 
   automatically, as opposed to continuing on to execute the section of
   code associated with the else part.  Thus, we have an inconsistency
   in C's design: with one flow-of-control construct (the switch), it is
   necessary to use a dangerous GOTO to achieve normal processing, whereas
   with a similar flow-of-control construct (the if-else), the default is
   reversed.  Given such a language design, it should not surprise anyone
   that programmers become confused, particularly when the constructs are
   being used together. 

   Ada, on the other hand, is consistent: in both the if and case statements,
   the default is to exit the construct once the code associated with the
   specified situation has been executed.  Ada also provides the exit
   statement, a restricted GOTO which permits a loop to be exited early,
   but this construct is not used (as is C's break) on a routine basis.  

> In my limited experience the cases where Ada is introduced into a
> programming environment also introduce lots of other good software
> engineering practices.  For example, lots of people I know who
> program in C don't use LINT.   I view it as a deficiency of management
> and not of the language that they don't use available tools.

   This is certainly true; Brooks and others have noted that the good
   software engineering practices which are routinely introduced in
   conjunction with the Ada language are responsible for more of the 
   resulting improvements than the fact that the Ada language was
   introduced.  However, we cannot disregard that fact that Ada was
   specifically designed to provide maximal support for the software 
   engineering process.  C, on the other hand, was designed to provide
   maximal support for the compilation process.  Since compilers and 
   the CPU power required to operate them come far more cheaply than 
   programmers, and especially in view of the fact that better error
   prevention is worth much more than faster compilation, it would seem
   that the tradeoff made by Ada is certainly the one to be preferred.


   Bill Wolfe, wtwolfe@hubcap.clemson.edu

  reply	other threads:[~1990-02-21 20:15 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-02-20 22:28 problems/risks due to programming language, stories requested Gerald Baumgartner
1990-02-21 16:49 ` Richard A Hammond
1990-02-21 20:15   ` William Thomas Wolfe, 2847  [this message]
1990-02-21 22:49     ` problems/risks due to programming language Richard A Hammond
1990-02-21 23:14     ` John F Nixon
1990-02-22  5:39     ` Scott MacHaffie
1990-02-22 20:13       ` William Thomas Wolfe, 2847 
1990-02-23 17:32         ` Richard A Hammond
1990-02-25 20:23           ` David Kassover
1990-02-22 20:48       ` Jeff Lawhorn
1990-02-23  2:00       ` Douglas Miller
1990-02-22 16:05         ` Dan L. Pierson
1990-02-22 20:28           ` David Kassover
1990-02-24 19:52           ` Erland Sommarskog
1990-02-23 17:45         ` Mike Harrison
1990-02-27  2:02           ` Douglas Miller
1990-02-22 18:28     ` Mike Percy
1990-02-23  2:09     ` Douglas Miller
1990-02-22  0:25   ` problems/risks due to programming language, stories requested David Kassover
1990-02-22  3:42     ` Richard A Hammond
1990-02-22 16:08       ` David Kassover
1990-02-22 16:21       ` David Kassover
1990-02-23 18:11 ` Thomas Vachuska
1990-02-24  0:13 ` Mark Brader
1990-02-27 19:30 ` Bill Leonard
1990-02-28 18:57   ` Paul Snively
1990-02-28 21:35     ` Jason Coughlin
1990-03-01 19:00       ` Barry Margolin
1990-03-02 13:31         ` Richard A Hammond
1990-03-02 19:26           ` William Thomas Wolfe, 2847 
1990-03-02 22:19             ` Richard A Hammond
1990-03-06 21:54               ` John Boone
1990-03-03 20:18             ` Charles E Eaker
1990-03-03 21:11               ` Invalid analogy William Thomas Wolfe, 2847 
1990-03-03 23:26                 ` I Wish
1990-03-05 19:51                 ` John F Nixon
1990-03-09 17:20                 ` Tony Sanders
1990-03-01 15:33     ` problems/risks due to programming language, stories requested Jeff Dalton
1990-03-01 21:42       ` Chuck Lins
1990-03-02 19:19     ` David F. Carlson
1990-03-02 22:15       ` William Thomas Wolfe, 2847 
1990-03-06 10:11         ` jbaker
1990-03-08 15:19           ` Lou Steinberg
1990-03-08 21:44             ` Gianfranco Ciardo
1990-03-09 16:18               ` David Kassover
1990-03-09 16:55               ` Erann Gat
1990-03-10 17:50               ` Andrew P. Mullhaupt
1990-03-12  4:06                 ` Peter da Silva
1990-03-12 16:58                 ` Jeff Clark
1990-03-12 20:20                 ` Proposal comp.lang.jihad (was Re: problems/risks due to blah etc.) What`s in a name?
1990-03-09 20:13         ` problems/risks due to programming language, stories requested Tony Sanders
1990-03-13 22:11           ` Erland Sommarskog
1990-03-19  1:01           ` Ada vs C, objectivity requested Lucio de Re
1990-03-26 20:37             ` Karl Heuer
1990-03-15 15:31         ` problems/risks due to programming language, stories requested jaws
1990-03-02 23:27       ` Jim Giles
1990-03-03  2:23         ` Vincent Manis
1990-03-03  2:10       ` problems/risks due to programming language Karl Heuer
1990-03-02 23:01     ` problems/risks due to programming language, stories requested William J. Bouma
1990-03-14  4:46     ` Lindsay Groves
  -- strict thread matches above, loose matches on Subject: below --
1990-02-23  6:46 problems/risks due to programming language Scott MacHaffie
     [not found] <10811@june.cs.washington.edu% <8126@hubcap.clemson.edu% <10838@june.cs.washington.edu>
1990-02-23 18:55 ` B. S. Oplinger
1990-02-24 19:39 Erland Sommarskog
     [not found] <5432@crdgw1.crd.ge.com) <8103@hubcap.clemson.edu) <10811@june.cs.washington.edu) <806@enea.se>
1990-02-26 18:48 ` What`s in a name?
1990-02-26 22:02   ` Karl Heuer
1990-03-02 10:57   ` Erland Sommarskog
replies disabled

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