From: Charles Mills Date: 2004-08-28T09:50:36+09:00 Subject: Re: performance comparison On Aug 27, 2004, at 5:06 PM, David Ross wrote: > > --- Lothar Scholz > wrote: > >> Hello Charles, >> >> >>>> >>>> --- Lothar Scholz >> >>>> wrote: >>>> >>>>> Typos are by definition easier to find in static >>>>> typed programs. >>>> >>>> Oh really? That would explain the 20 million >> dollar >>>> bug.. >>>> >>>> s=2 when it was meant to be s==2 >>>> :) >>>> >> >> CM> Did you get that deep C secret from "Expert C >> Programming"? :) >> >> And everyone who repeats the rules while sleeping >> would write the latter as 2==s >> >> -- >> Best regards, emailto: >> scholz at scriptolutions dot com > > That is a very programming habit, and one that I > follow. Unfortunately not everyone does. Most people > don't even read the `man syntax` in *BSD. Which > aparently has very good coding style which everyone > should follow. > > --David Ross > Agreed that is a good habit and I can't say I follow it myself... if you interested I found the 20 million dollar bug on google: -------- In Spring 1993, in the Operating System development group at SunSoft, we had a "priority one" bug report come in describing a problem in the asynchronous I/O library. The bug was holding up the sale of $20 million worth of hardware to a customer who specifically needed the library functionality, so we were extremely motivated to find it. After some intensive debugging sessions, the problem was finally traced to a statement that read: x==2; It was a typo for what was intended to be an assignment statement. The programmer's finger had bounced on the "equals" key, accidentally pressing it twice instead of once. The statement as written compared x to 2, generated true or false, and discarded the result. C is enough of an expression language that the compiler did not complain about a statement which evaluated an expression, had no side-effects, and simply threw away the result. We didn't know whether to bless our good fortune at locating the problem, or cry with frustration at such a common typing error causing such an expensive problem. Some versions of the lint program would have detected this problem, but it's all too easy to avoid the automatic use of this essential tool. -------- -Charlie