The line below is inside a for loop. If the method fails, it needs to break. CATEGORY_1 is an enum. I added this enum as a new parameter to AddToList method with a default value. If you see closely below, I actually made the mistake of putting the comma and the enum outside the parameter list of the function. This compiles perfectly fine with VS2010. So I had a hard time finding that that the default value was being passed for that parameter instead of CATEGORY_1.
Does anyone know why this succeeds?
if (! AddToList(obj1, (unsigned int) Val), CATEGORY_1)
{
break;
}
In C++, the comma isn’t just a separator; it can also be an operator. That comma is an operator. The comma operator evaluates the first expression, discards the result, then evaluates the second expression and yields its result.
[Of course, the comma operator, like most other operators, can be overloaded, and if an overload is used here, the semantics could be different. This is the behavior of the built-in comma operator.]