Hacker News new | past | comments | ask | show | jobs | submit login

IMO, this is a better book at explaining C clearly: "advanced programming in the unix environment" by W. Richard Stevens. Don't be fooled by the title.. it's a beginner book.

> Don't be fooled by the title.. it's a beginner book.

I never know what to do with comments like this. It's obviously not a beginner's book. At the very least, it assumes that you know C. If your response is "C is a small language. You can learn it by reading <some-other-thing>.", you're admitting that APUE is not a beginner's book. If your response is, "C is a small language. You can learn it by reading APUE itself.", then I call bullshit. Is it theoretically possible, sure. But is it a natural way for a true beginner to learn C? Certainly not.

> It's obviously not a beginner's book.

What do you mean by this? You obviously have NOT read it. I have. I'm telling you it is a beginner book. It does not assume you know C or anything else. It has nothing to do with the size of C. Grabbed it off my bookshelf -- he starts off telling you how to login to a unix system. How advanced can it be?

This is literally the book that taught me the basics of C within a week -- the first language I learned (15 years ago). So it is definitely a beginner book IMO.

Edit: I will say, he does get into some more advanced things toward the end. Which is why I like the book.. he starts off very basic, and by the end, he's covered the basics of interprocess communication, shared memory, etc.

I have read the book. It does not teach you C. It assumes that you know the language. It does not teach you anything about the syntax of the language.

He does not tell you how to log into a UNIX system. He tells you what happens when you log into a UNIX system. (That is a big difference. Compare the first chapter of Kerrigan and Pike's The Unix Programming Environment, which actually does teach about terminals and explicitly talks about how to log in and what a login is -- for a complete beginner.)

Here's the first bit of code, from page 5:

    #include "apue.h"
    #include <dirent.h>
    main(int argc, char *argv[])
    	DIR		*dp;
    	struct dirent	*dirp;
    	if (argc != 2)
    		err_quit("usage: ls directory_name");
    	if ((dp = opendir(argv[1])) == NULL)
    		err_sys("can't open %s", argv[1]);
    	while ((dirp = readdir(dp)) != NULL)
    		printf("%s\n", dirp->d_name);
My point is very simple: If you do not know C and especially if you also do not know any programming language, it would require either magic or another book or tutorial to figure out the syntax or semantics of those lines. Why is the first include thingy in quotes and the second in brackets? What is an include thingy anyhow? What is DIR? Why do some things have a * in front of them? When are semicolons used? Not every line ends in one, but most do - why? What is the -> used for? When do I use parentheses and when do I use braces? What is argc or argv? Are those names important? What is NULL? Why are some things all capitals and some not. Does that matter? He doesn't answer any of these questions (nor should he), because the book is not meant to teach you C. It assumes that you already know C.

It is not a beginner's book.

Here's a bit of code from page 10:

  #include "ourhdr.h"

    printf("hello world from process ID %d\n", getpid());
Ch 7 is the environment of a unix process. 7.2: "argc is the number of command line arguments and argv is an array of pointers to the arguments. We describe these in Section 7.4." exit codes are discussed in section 7.3, where he also talks about 0 in exit.

Granted, he does not discuss the syntax or NULL...

Looking through it.. I'll agree it isn't a beginner book. Intermediate at worst though.

Hmm... Having not seen the first edition of the book (which is the edition you must have given that you used it 15 years ago and it was updated 8 years ago), it's possible that your assessment of its elementary content is specific to that edition.

However, the second edition of the text is by no means elementary; unless you are conflating beginner literature with comprehensive literature, and the text is certainly comprehensive.

I'll grant you that Chapter 1 is a summary and introduction to the entire book with little challenging or novel material for someone experienced with UNIX and C, but many advanced texts have introductory sections. A large portion of the "The Art of Computer Programming: Fundamental Algorithms" is essentially a review of the elementary mathematics necessary for the analysis of algorithms, but I would never call TAOP a "beginners book"!

This thread has been interesting for me. The first time I've opened the book in 13-14 years probably. Not exactly what I remembered. So just ignore my posts :)

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact