tags:

views:

1241

answers:

3

I need a book that deals with implementing real projects in C, in contrast to "C Programming Language" which I recently finished reading and mastered, that only teaches the language. Something that deals with advanced topics such as: how to organize the source files, how to organize headers, more advanced preprocessing directive like #ifndef, #ifdef and how and when to use them. How to deal with various kinds of input, how to parse it, etc.

I already have these books, but none of them is what I'm looking for (although they're good ones):

  • C Traps and Pitfalls by Andrew Koenig
  • Expert C Programming by Peter van der Linden
  • C Programming Language (2nd Edition) (Prentice Hall Software) by Brian W. Kernighan and Dennis M. Ritchie
  • The Standard C Library by P.J. Plauger
+4  A: 

I honestly don't think you will find any more "advanced" books than the ones you list, except when it comes to special areas like sockets, databases, GUIs etc. C is really not a very complicated language.

anon
+7  A: 

To be honest, I learned most of that stuff by checking out the source code to real projects written in C (after reading K&R, of course). If you browse through a few C projects of appropriate size and quality, you'll quickly pick up on the standard ways to organize source and header files, and you'll see how "real" programmers use the preprocessor.

mipadi
Can you recommend a good source code for viewing? preferably small.
Leif Ericson
I learned a lot from the Core Utils library of the GNU project: particularly look at ftp://ftp.gnu.org/gnu/coreutils, I found it very good. Particularly text handling ones like cat or wc, but others are very informative too. Look at them critically though, do not accept everything you see.
Dervin Thunk
+2  A: 

I think the knowledge you're looking for is to be found not in books about C but in books and articles about system design. These are fairly thin on the ground, unfortunately. You might consider

  • Abstraction and Specification in Program Development by Barbara Liskov and John Guttag (not the newer Java-based version by Liskov alone). It is an undergraduate text but has some ideas worth thinking about.

  • Books from the late 1970s and early 1980s by Yourdon and Myers on structured design (one is called Composite/Structured Design.

  • For an example of how to organize a big C project as a bunch of useful libraries, you can't beat C Interfaces and Implementations](http://www.cs.princeton.edu/software/cii/) by Dave Hanson. Basically Hanson took all the code he'd written as part of building Icon and lcc and pulled out the best bits in a form that other people could reuse for their own projects. It's a model of good C programming using modern design techniques (including Liskov's data abstraction).

Norman Ramsey