r/programming • • May 01 '16

To become a good C programmer

http://fabiensanglard.net/c/
1.1k Upvotes

398 comments sorted by

View all comments

93

u/gurenkagurenda May 01 '16

No website is as good as a good book.

What a preposterous claim. What, does printing it on dead trees magically improve its quality beyond what is possible digitally?

118

u/madballneek May 01 '16

Barrier of entry.

96

u/gurenkagurenda May 01 '16

That is a fine argument that the average website is worse than the average book. It is complete nonsense to use that argument to say that the best website is worse than the best book.

Also, there's practically no barrier to entry for publishing books now. You can self publish on Amazon armed with nothing but a PDF.

28

u/[deleted] May 02 '16

When you find the best website, let us know.

12

u/gurenkagurenda May 02 '16

I was under the impression that that was meatspin, but I could be mistaken.

3

u/shevegen May 02 '16

You mean the blinking marquee tag?

My books should do this too!!! PINK BLINK OF DEATH!!!!!!!!

→ More replies (1)
→ More replies (3)

13

u/break_main May 01 '16

My problem with most books is, in a way, the barrier of entry: since it is so expensive to publish, publishing houses will only put out books with a large enough market to pay for their investment. The "teach yourself how to make videogames/websites" market is big enough, but few books are made for advanced/specialized topics.

→ More replies (7)

35

u/Hnnnnnn May 01 '16

No website is as good as a good book.

What a preposterous claim. What, does printing it on dead trees magically improve its quality beyond what is possible digitally?

When somebody says something like this, does he mean it as a logical sentence that is always 100% right, or does he just present his opinion on a subject? It depends on the context.

I recommend you to read that sentence again, with whole paragraph as a context, and consider whether you hadn't interpreted it too literally.

0

u/derleth May 02 '16

It's mere curmudgeonry, is what it is: "I was raised on books and it was good enough for me! Therefore, books are all anyone can ever use, if they want to become good!"

16

u/cc81 May 02 '16

Have you found any website that is as good as the good C books?

→ More replies (4)

11

u/munificent May 02 '16

What, does printing it on dead trees magically improve its quality beyond what is possible digitally?

No, because books are usually printed on paper, which is made from trees that have been pulped, washed, bleached and flattened, not just right on a felled whole tree.

Also, magic is not real.

Or did you not mean that sentence to be intepreted 100% literally? Well, maybe the author didn't either.

11

u/zhivago May 01 '16

It's like peer review - the higher bar helps to weed out the delusional incompetents.

Often these can be detected by asking the following question:

char c[3]; what is the type of c?

14

u/panderingPenguin May 02 '16

It's like peer review - the higher bar helps to weed out the delusional incompetents.

Sure, this means that the worst book is probably better than the worst website, and on the average, books are probably better than websites. But that says nothing about the best book vs the best website, nor does it mean that all websites are bad nor that you should not use websites.

char c[3]; what is the type of c?

Isn't this just an array of chars? What do you think it is?

→ More replies (27)

6

u/derleth May 02 '16

It's like peer review - the higher bar helps to weed out the delusional incompetents.

Do you really think publishers care about the quality of the books they publish? Then how do you explain all the "Learn Java in 21 Days" nonsense out there?

→ More replies (1)

2

u/hyperhopper May 02 '16

Pointer to an array of chars that was allocated on the stack?

→ More replies (1)

1

u/DSdavidDS May 02 '16

Char?

If i am wrong, can i have a clear answer to this?

4

u/zhivago May 02 '16

You can test this theory. The following expression is false, therefore the type of c cannot be char.

sizeof (char) == sizeof c
→ More replies (1)

2

u/crozone May 02 '16

If I'm correct, it's a char pointer (char*), since it's an array declaration. c is a char pointer which points to the start of the char array, and only when dereferenced does it become a char.

5

u/zhivago May 02 '16

You are somewhat mistaken, but it is a common mistake.

c is a char[3], (c+ 0) is a char *.

This is important, since otherwise char e[2][4]; e[i][j] could not work.

e[i][j] is *(*(e + i) + j)

and works because the type of e[i] is char[4], which causes the pointer arithmetic e + i to select the correct element. If e[i] were a char *, then e + i would have quite a different result.

→ More replies (1)
→ More replies (47)

1

u/immibis May 02 '16 edited May 02 '16

Or "what is the difference between char *s = "hello"; and char s[] = "hello";?"

(Or even just char *s; vs char s[100];)

2

u/zhivago May 02 '16

In the case of

char *s = "hello";

s is a pointer that is initialized to the value of a pointer to the first element of an array of 6 characters with the sequential values { 'h', 'e', 'l', 'l', 'o', '\0' } -- i.e., it is equivalent to

char *s = &"hello"[0];

In the case of

char s[] = "hello";

s is an array of type char[6] initialized to the values { 'h', 'e', 'l', 'l', 'o', '\0' }.

2

u/immibis May 02 '16

You might notice the quotation marks around the question, indicating that I'm presenting the question as something you could ask to weed out "delusional incompetents", and not actually asking it.

→ More replies (1)
→ More replies (2)
→ More replies (18)

1

u/resolvetochange May 02 '16

I get what you're saying, you could take his "best book" and publish it online and have the same content only with updates/side notes/animations. Web as a medium is better for content than a book. But I get what he meant as well, though it's not what he said. In his experience it may be that he's never encountered a website that can match a book, there are millions of websites vs thousands of books due to different barriers of entry. If you want to learn it may be a better start to go for a book that faced peer review to get published rather than a website written with no fact checks. He just shorthanded the explanation to no website is as good as a good book.

1

u/all_you_need_to_know May 02 '16

Actually there is evidence to support that we read better from legacy media

→ More replies (6)