K&R code
23 Sep 2002I am currently reading The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie (the ubiquitous K&R).
I am also doing all the exercises chapter by chapter and I decided to put up a website to track my progress with the exercises and provide a space for people to critique my code. (or, just tell me how badly it sucks).
I have recently decided once and for all to learn how to program competently. The main reason for this is that I have grown tired of, upon sending feature suggestions or bug reports to various developers, getting “feel free to contribute code!” in response.
Then, instead of just saying “screw you, you’re the developer!”, I can whip up some code and wave it in their fat faces. Ah, spite, the great motivator.
Chris - I think you should put more comments in your code.
What happens is that you understand the code completely and inside-out when you first write it. But a month later, you’ll look back at it, and not have a clue why you wrote it the way you did.
The best type of comments say why you coded it in a certain way, not just what you’re doing.