Important reminder just in the Preface :-)
Takeaway #1: "C and C++ are different: don’t mix them, and don’t mix them up"
replies(8):
Takeaway #1: "C and C++ are different: don’t mix them, and don’t mix them up"
Why is that?
This is not one of those beginner -> journeyman -> expert cycles where coincidentally the way you wrote it as a beginner is identical to how an expert writes it but for a very different reason. I'd expect experts are very comfortable writing either { x = k; k += 1; } or { k += 1; x = k; } depending on which they meant and don't feel an itch to re-write these as { x = k++; } and { x = ++k; } respectively.
I'm slightly surprised none of the joke languages add equally frivolous operators. a%% to set a to the remainder after dividing a by 10, or b** to set b as two to the power b or some other silliness.
void strcpy(char *s, char *t)
{
while (*s++ = *t++)
;
}
(straight from K&R) wouldn’t work without it. * is it (*s)++ or *(s++)?
* it is not *++s nor ++*s
And I have seen *(*s)++
in some places!It is concise syntax but very confusing.