[OT] Walter about compilers

Era Scarecrow rtcvb32 at yahoo.com
Wed Jan 23 04:34:25 PST 2013


On Wednesday, 23 January 2013 at 09:46:47 UTC, Don wrote:
> "There has been no error reported in TeX since 1994 or 1995"  
> -- Knuth, 2002.
> There were 7 bugs in TeX reported between 1982 and 1995.
> Tex has a lot more than 70 lines of code :-)

  Bugs in code don't always live on one line per bug; They can 
span multiple very easily. Some bugs are simply missing logic, 
untested cases, no default values in variables. Now if we have a 
while loop and you modify the index at the wrong spot you need to 
move it, making it have a bug spanning at least two lines.

  Some bugs are known but for the most part ignored, like memory 
management for very tiny programs. Many error values returned by 
the OS & errorno are ignored, but don't usually have any 
catastrophic effects.

  Some bugs are the effect of using a macro which expands. 
Logically it makes sense, but the macro makes it unstable at 
best; while an actual function wouldn't have a bug.

   #define min(a,b) ((a)>(b) ? (b) : (a))

   int a=1,b=2,c;
   c = min(a++, b++); //minimum of both a or b, and increase each 
once

   //will any of these pass?
   assert(c == 1);
   assert(a == 2);
   assert(b == 3);


More information about the Digitalmars-d mailing list