Original Post
🔒 Locked
Compiler error ?
Advertisement
Quote:
It should be discovered as parse error during compilation.
No it shouldn't. C++ has a comma expression which allows you to do this. The value of the expression is, I think, the last in the list (otherwise the first).
10 == 1,2,3,4,5,6,7,8,9,10This is a valid expression and is also true. In your example the cast is superfluous btw.
Its use is when some of the expressions's evaluations have side effects such as:
unsigned int s = 0;while( cin >> i, i > 0 ) s += i;Illco
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement