From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 11 Dec 92 13:29:42 GMT From: agate!spool.mu.edu!uwm.edu!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mkso l!mccall@ucbvax.Berkeley.EDU (fred j mccall 575-3539) Subject: Re: FORTRAN bug(was Re: C++ vs. Ada -- Is Ada loosing?) Message-ID: <1992Dec11.132942.24054@mksol.dseg.ti.com> List-Id: In <1992Dec9.060218.23940@seas.gwu.edu> mfeldman@seas.gwu.edu (Michael Feldman) writes: >In article <1992Dec8.172551.16780@newshost.lanl.gov> jlg@cochiti.lanl.gov (J. Giles) writes: >[stuff deleted] >> >>Well, not quite. The proper moral is that all programming languages >>(even informal specification languages) have contexts in which single >>character errors can lead to linguistically correct programs which >>don't compute the intended functionality. The moral often stated >>instead is that this is a bad feature of Fortran. While Fortran >>could indeed have been designed better, it is not the only language >>with, or even the most severly affected by, this kind of problem. >> >You make a good point. Perhaps the modern equivalent of that Fortran >single-keystroke bug is my favorite bit of C code (and no, I don't >want to bash C, just point out how common these flukes are): > int x; > ... > x = 1; > while (x <= 10); > { > printf("%d\n", x); ^^^ > x++; > } >For 10 points on your grade: what is printed? Why? >Try explaining it to a freshman. Nothing is printed. You built an infinite loop. This is hard to understand? You made a while loop with an empty body and a condition that is never met because you never increment x. Your freshmen don't get this? >Any similar idiosyncracies in Ada? Single character ones? Probably not, but that just indicates that Ada is incredibly more verbose than C. One of the things I DISlike about it, by the way. -- "Insisting on perfect safety is for people who don't have the balls to live in the real world." -- Mary Shafer, NASA Ames Dryden ------------------------------------------------------------------------------ Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.