News for hackers. Stuff that matters.
Re:Modern C, Second Edition by ufo on Wednesday September 18, 2019 @06:25PM (#21011023)
K&R is a well written book, and is very pleasant to read. IMO, it is one of those books that everyone should read one day or the other.

The main thing to watch out about it these days is that K&R is a bit carefree about the numerous ways where you can shoot yourself in the foot using C. For example, K&R famously implements strcpy as `while(dst++ = dst++);`. These days, most people would say that code is excessively terse, and that you shouldn't be using strcpy in the first place (because it can potentially overflow the dst buffer).

Re:Modern C, Second Edition by einpoklum on Thursday September 19, 2019 @04:24AM (#21014375)
You meant:

while ((dst++) = (src++))

I believe.

Re:Modern C, Second Edition by Gibbon1 on Thursday September 19, 2019 @05:17AM (#21014580)
while ((dst++) = (src++));
Re:Modern C, Second Edition by billforsternz on Thursday September 19, 2019 @07:21AM (#21015183)
Both of these replies are missing the asterisks to indicate pointer indirection. Probably HN is eating each asterisk, treating it as emphasis or something.

Also terse it may be, but this (assuming the missing asterisks are restored) is a good, idiomatic implementation of strcpy. Whether strcpy is good or evil is a separate discussion.