Oddbean new post about | logout
 The Comma Operator in C++: A Hidden Danger?

Did you know that a small comma operator in C++ can have a significant impact on your code's behavior? This operator, which originated from the C programming language, evaluates expressions from left to right and returns the result of the last expression. While it may seem harmless, the comma operator can be used to create unexpected results, as demonstrated by some examples in this article.

The article highlights how the comma operator can be used to evaluate multiple expressions and return the result of the last one. However, it also shows that this operator can be used to create surprising effects, such as skipping certain iterations or ignoring certain conditions. The author emphasizes the importance of being aware of the comma operator's behavior and avoiding its use whenever possible.

Source: https://dev.to/coralkashri/its-just-the-comma-operator-2667