Thursday, January 22, 2009

How to debug a C program.

1] If at all possible, don't. Let someone else do it.
2] Change majors. (Win.)
3] Insert/remove blank lines at random spots, re-compile, and excecute.
4] Throw holy water on the terminal.
5] Dial 911 and scream.
6] There is rumour that "printf" is useful, but this is probably
7] Port everything to CP/M.
8] If it still doesn't work, re-write it in assembler. This won't fix the
bug, but it will make sure no one else finds it and makes you look bad.

PASCAL is not a language. It was an experiment combining the flexibility of C with that of a drug-crazed penguin. It is also the 'language' of choice of many CS professors who aren't up to handling REAL programming. Hence, it is not a language.

C is almost a real language. (see assembler) Even the name sounds like it's gone through an optimizing compiler. Get rid of all of those stupid brackets and we'll talk. (see LISP)

ASSEMBLER is a language. Any language that can take a half-dozen keystrokes and compile it down to one byte of code is all right in my books. Though for the REAL programmer, assembler is a waste of time. Why use a compiler when you can code directly into memory through a front panel?

How to program in C
1] Use lots of global variables.
2] Give them cryptic names such as: X27, a_gcl, or Horace.
3] Put everything in one large .h file.
4] Implement the entire project at once.
5] Use macros and #defines to emulate Pascal.
6] Assume the compiler takes care of all the little details you didn't quite

If you put garbage in a computer nothing comes out but garbage. But this garbage, having passed through a very expensive machine, is somehow enobled and none dare criticize it.

Any sufficiently advanced bug is indistinguishable from a feature.


Post a Comment

Subscribe to Post Comments [Atom]

<< Home