Live data from Hacker News

Don't Learn C the Wrong Way

hentenaar.com

1–10 of 53 posts

Re: Don't Learn C the Wrong Way

#2
>>Let me start by saying that unlike Mr. Shaw, I am not a writer. I'm an engineer.

Zed Shaw, whilst his approach to certain issues may be questionable, is not "a writer rather than an engineer".

Zed is known as one of the most prolific and capable software engineers around and I have heard his C code for Mongrel 2 server https://github.com/zedshaw/mongrel2 described as being amongst some of the best examples of C code to study, learn and understand (trying to find the link that said that). I hold his work in high regard.

I don't agree with everything that Zed does and think it's a pity that his combative and dogmatic nature detracts from the core message about his work, but the author of this blog post is off track if he is trying to suggest that Zed doesn't know what he is doing and is "a writer" rather than "a software engineer". Zed is a (cantankerous) software engineer and a writer.

The attempt to discredit Zed's credentials just discredits the blog post and its author. When criticizing, criticize the work rather than the person.

Re: Don't Learn C the Wrong Way

#3
Part 3:

"Wait a tic... Where's the Makefile? I've got just about as much chance of finding it as the FBI does of finding Jimmy Hoffa. Am I just supposed to imagine it into existence?"

I think the point is that the make command can use implicit rules even if there is no Makefile. It knows how to compile C source files. (This could be confusing if you know about "make" but don't know about implicit rules.) For example:

    $ ls
    hello.c
    $ cat hello.c
    #include 
    int main(void) {
        puts("hello");
        return 0;
    }
    $ make hello
    cc     hello.c   -o hello
    $ ./hello
    hello
    $
Later: "So, I'm just supposed to poke in some code, go to my terminal, type this magic 'make' word, and expect a built and working program, right?"

Yes, that's exactly what you're supposed to do. Try it, it should work.

Part 10 mentions strncpy() as a safer strcpy(). It isn't. http://the-flat-trantor-society.blogspot.com/2012/03/no-strn...

(Disclaimer: I haven't read Zed Shaw's book, and I don't intend to.)

Re: Don't Learn C the Wrong Way

#5
> C was designed on UNIX, and was basically made for UNIX. That's a matter of historical record. But to say that on Windows everything is a little "off", doesn't quite do it justice. I understand that the book is aimed at the uninitiated, but to put it that mildly is an understatement of epic proportions.

Yeah, this was the fist sign I wouldn't read to the end, and I was right. The author just says this, and leaves it at that. As if we are to just take his word for it. This is essentially what this argument boils down to:

"He said X, I say X++." No explanation, nothing to backup what he says, nothing other than a to suggest it's a epic understatement.

Let's put this another way: my comment is has more to backup what I say than this article. The author might be right, but he doesn't back it up.

Re: Don't Learn C the Wrong Way

#7
post #2

>>Let me start by saying that unlike Mr. Shaw, I am not a writer. I'm an engineer. Zed Shaw, whilst his approach to certain issues may be questionable, is not "a writer rather than an engineer". Zed is known as one of the most prolific and capable software engineers around and I have heard his C code for Mongrel 2 server https://github.com/zedshaw/mongrel2 described as being amongst some of the best examples of C cod…

This is the second time this post has been voted to the front page of HN. It's puzzling. Are C programmers supposed to find this compelling now, when they didn't the first time around?

I wonder if it's simply a case of:

1. Zed Shaw is controversial on HN

2. I know, I'll write a post that disses Zed Shaw

3. ???

4. Profit!

Re: Don't Learn C the Wrong Way

#8

> C was designed on UNIX, and was basically made for UNIX. That's a matter of historical record. But to say that on Windows everything is a little "off", doesn't quite do it justice. I understand that the book is aimed at the uninitiated, but to put it that mildly is an understatement of epic proportions. Yeah, this was the fist sign I wouldn't read to the end, and I was right. The author just says this, and leaves i…

And I don't even understand why he doesn't agree that C is a second-class citizen on Windows. Microsoft would rather have you code stuff in C++ or .Net and MSVC is stuck with the C90 standard (although apparently that is finally improving)

Re: Don't Learn C the Wrong Way

#9
post #6

To me this read like a long list of nitpicks. Sounded like the author was just angry that Zed said bad things about the K&R book.

The author's jumping off point seems very much to be "I dislike Zed Shaw" versus, say, an earnest attempt to prevent novices from learning C the wrong way. That's a shame, because I think that would make for an interesting article.

Re: Don't Learn C the Wrong Way

#10
post #8

> C was designed on UNIX, and was basically made for UNIX. That's a matter of historical record. But to say that on Windows everything is a little "off", doesn't quite do it justice. I understand that the book is aimed at the uninitiated, but to put it that mildly is an understatement of epic proportions. Yeah, this was the fist sign I wouldn't read to the end, and I was right. The author just says this, and leaves i…

And I don't even understand why he doesn't agree that C is a second-class citizen on Windows. Microsoft would rather have you code stuff in C++ or .Net and MSVC is stuck with the C90 standard (although apparently that is finally improving)

When Windows first came out, the ONLY programming language for it was C. Nothing else.
Post reply on HN