K&R code

I 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.


Comments

Richard BourkeNovember 01, 2002 at 07:29 · reply

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.

Chris WageNovember 01, 2002 at 09:55 · reply

This is definitely true.. I hadn’t been commenting very well previously because I was in the “this is just an exercise” frame of mine, but no doubt it’s a good habit to get into, so I should probably start doing it even for these exercises.

Thanks! Your comment has been submitted and will appear shortly.


Leave a comment