4 ms·
The good news: there is a simple rule you can use instead of understanding all this. The simple rule? Write simple code. Don't write multiple assignments in
by jzwinck 12y ago
The good news: there is a simple rule you can use instead of understanding all this. The simple rule? Write simple code.
Don't write multiple assignments in a single statement. Don't overuse the ternary operator (?:). Don't overdo it with assignment inside larger statements like comparisons. These "don'ts" will make your code clearer to humans and you are much, much less likely to wind up with holes in your feet.
- sftrabbit 12y agoAuthor here - absolutely! This is only for those with an interest in the details of C++ evaluation. Considering the number of times I see these expressions in a purely theoretical context, I assume many people are at least intrigued.