[H-GEN] C programming idioms
Greg Black
gjb at gbch.net
Mon Feb 19 00:12:31 EST 2007
I see my attempt to move this to dsig has failed, so I'll just go with
the flow.
On 2007-02-19, Nick Kwiatkowski wrote:
> 1. Advanced Programming in the UNIX Environment, 1992, Stevens
>
> 2. UNIX Network Programming, 1990. Stevens
>
> Both are dated, but good reads with good examples.
I love the Stevens books, but they are not suited as an answer to the
original question, as they are only safe for people who already know C
properly -- because only those people will see the glaring errors of C
and good C practice in those books. Others will take the books as
gospel and will therefore go on to perpetuate the errors in yet more
code.
I'm not going to write a full review here, but I'll quickly mention two
of the things I'm talking about, one from each category.
He consistently writes signal handlers that are just plain wrong. Since
C programmers have to write signal handlers pretty frequently in real
code, this is pretty scary when the example code is taken as a guide.
And he consistently obfuscates his code in ways that make book writing
much easier, but that make both reading of the code and maintaining any
code based on it difficult -- if he explained at the outset that he was
doing this to save paper and said that it was not the way to code, it
would not be so bad; but he doesn't do that, and so it also leads to
people following his style and creating nightmarish results.
As I said, I like the books, but they are not for people who are not
already skilled C programmers.
Cheers, Greg
More information about the General
mailing list