Remix.run Logo
pjmlp 5 days ago

That is a myth often spread by folks that think K&R C book is everything there is to know, never opened the ISO C draft PDF, learned the differences between POSIX and standard library, tried to make their code portable outside GCC or nowadays clang, or even checked the extensions chapter on the compiler.

anta40 5 days ago | parent [-]

Who told that? I still hear K&R being recommended as introduction material.

If you want to write portable/production-grade C code, well definitely need to study another references.

Arch-TK 4 days ago | parent | next [-]

There are very few resources for learning C which aren't themselves full of terrible C.

If you want a short introduction with the caveat that it only covers C89, only covers parts of it, and doesn't cover e.g. POSIX or anything outside of standard C then K&R2 + errata is fine.

If you want a long book on C which has a more modern approach then there is K. N. King's C a Modern Approach.

Jens' book is at least vouched for by https://iso-9899.info/wiki/Books . So I have to assume it's also okay.

adamors 4 days ago | parent | prev | next [-]

Exactly, I was looking into refreshing my C knowledge recently and K&R is still heavily recommended.

flohofwoe 4 days ago | parent | next [-]

The problem with K&R is that there never was a third edition that covered C99, which compared to C89 is almost a new language.

K&R is an interesting historical artifact about the basic design decisions of the C language and definitely recommended reading material, but you're not doing yourself a favour using it as reference or for learning the language. For that it is vastly outdated, C ist a much more enjoyable and powerful language since C99.

pjmlp 4 days ago | parent | prev [-]

Go with such a book instead,

https://www.manning.com/books/modern-c

adamors 4 days ago | parent [-]

How does this compare to https://nostarch.com/effective-c-2nd-edition ?

pjmlp 4 days ago | parent [-]

I guess it is also a good one, both authors are still active on WG14, if I am not mistaken.

pjmlp 4 days ago | parent | prev [-]

Because most people know no better, and recommend their UNIX heros.

This is a more useful book for modern days,

https://www.manning.com/books/modern-c

flohofwoe already put it out clearly on his comment.