by chhickman · 5y ago · 0 comments
I think the "don't be clever" edict applies to code segments that are best described as "you won't believe what happens next!", and fairly so.
Reusing variables in a way that is confusing is a code smell, and rather than being "unclever", I would characterize it more as just "bad".
In my mind, an example of code that is "too clever" looks more like this:
while (*dest++ = *src++);
Unless you've seen that exact pattern many times, when trying to understand it you will have to unwrap it in your mind into something that looks more like the longer, "unclever" version anyway.