Need to learn C, best books?

David Cantrell david at
Thu Oct 25 12:36:16 BST 2007

On Wed, Oct 24, 2007 at 06:09:57PM +0100, Andy Armstrong wrote:
> On 24 Oct 2007, at 18:01, Lyle - wrote:
> > I've been talking with the FCGI developers about helping them with  
> >guides, etc. Funnily enough, the need right now for knowing C and  
> >XS is to be able to read the FastCGI C libraries. My plan is to  
> >work my way through commenting each line and heavily commenting  
> >each routine. I think it'll be useful for other people as well as  
> >getting my C up to speed.
> Good work - but *please* don't fall into the trap of comments that  
> just describe what the code does. You need to assume that most people  
> who look at the code can read it pretty well. Concentrate on  
> commenting that which is non-obvious.
> Yes, 'non-obvious' is subjective. But
>   size_t sl = strlen(somestring); /* get length of string */
> would be bad :)

My rule of thumb is to comment the algorithm, not the implementation
details.  So yeah, the example you give is bad, but this ...

  size_t sl = strlen(somestring); /* we'll use this value later for ...

is useful.

David Cantrell | Hero of the Information Age

    Wow, my first sigquoting! I feel so special now!
        -- Dan Sugalski

More information about the mailing list