Pages

Tuesday, 13 January 2009

BBC NEWS | Technology | Dangerous coding errors revealed

http://news.bbc.co.uk/1/hi/technology/7824939.stm
The worst ones I've seen: (some of which are listed)
Not being specified right in the first place
Not reading the (correct) spec
"." instead of "," (or vice verse)
missing {braces}
Memory leaks/buffer overrun/broken stacks
Buggy compilers and processors
Just not considering everything ("Millennium bug" was most often caused by this -Century-change/rolling over using 2 digits to store numbers which could be 4 digits long - not allowing for minutes to be up to 61 seconds long, 16-bits to store much larger values...)
Floating-point related oddities
UNTESTED CODE! - If somone would have tested the applications properly, often the bugs would be located.

7 comments:

  1. Assignments instead of conditions ( = instead of == ) can be a bugger, especially if it works (by fluke) for the majority of the time.

    {I saw the article yesterday but it's still in the 'to read' pile}

    ReplyDelete
  2. Ah, of course, how could I forget. I had a (self-imposed) rule of using personalized macros to avoid that sort of thing
    #define EQUALS ==
    #define NOT_EQUALS !=
    {It annoyed everyone else, but I didn't care}

    ReplyDelete
  3. Damn you, Kernighan and/or Ritchie.
    Damn you to Hell.

    (Always put the constant on the LHS)

    ReplyDelete
  4. If I'm having an out of memory experience this must be line one.

    ReplyDelete