Software Development with Linux

Notes on Programming in C

MON, 01 JUN 2009

Rob Pike wrote many things. Among those things, there are two great books : The Practice of Programming (with Brian W. Kernighan) and The Unix Programming Environment (also with Brian W. Kernighan).

But, I recently stumble upon another interesting text by Rob Pike : Notes on Programming in C. Those "notes" are a small set of essays about programming. They are targeted at C programming, but the paper is still a great read for any other programming language.

The last essay of it is about include files. It says that you shouldn't include files from include files. Instead, you should mention (in a comment) that some other include file should be included first. I re-read it more then once, but I have never been able to agree with this.

Using his suggestion, you could have to include many files, about stuff you don't care. If you're using some library, you shouldn't have to include all the dependencies of that library directly. This would remove separation of code. When I use a library, I expect to "#include ", but not all the std and boost included used by that.

But, as Rob is mentioning in the first paragraphs :
"... they are opinions, and opinions change with the times."
I would like to know if Rob is still thinking the same way about this.