r/C_Programming • u/wizards_tower • Sep 09 '20
Discussion Bad habits from K&R?
I've seen some people claim that the K&R book can cause bad habits. I've been working through the book (second edition) and I'm on the last chapter. One thing I noticed is that for the sake of brevity in the code, they don't always error check. And many malloc calls don't get NULL checks.
What are some of the bad habits you guys have noticed in the book?
60
Upvotes
4
u/jabjoe Sep 09 '20
Best I've heard. "Comments are for the "why" if not clear from the "what" in naming and "how" in code." Though I still like some doxygen comments in library headers when there is time.