|
|
> I have a similar issue with stuff like
>
> while (*x++ = *y++) {}
FYI, I have an issue with stuff like that too. C and C++ do make it easy to
write bad code. This is the second time you've mentioned that example, so I
assume someone once showed it to you and thought they were being clever.
They weren't! Or maybe it's just a popular example, because I was just
reading a book about coding style last night that gave that as a bad
example.
That code tries to do too much at once and is difficult to understand. If
you made a small mistake while writing it, it wouldn't be immediately
obvious that there's a problem with the logic. It's bad code. Its only use
is to help you understand operator precedence and the behavior of the
different operators. It's very possible to write code that does the same
thing in a clearer way.
C and C++ just require responsibility. =)
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|
|