In C++, the comma token (i.e.,
,
) is either interpreted as a comma operator or as a comma separator.However, while searching in the web I realized that it's not quite clear in which cases the
,
token is interpreted as the binary comma operator and where is interpreted as a separator between statements.Moreover, considering multiple statements/expressions in one line separated by
,
(e.g.,a = 1, b = 2, c = 3;
), there's a turbidness on the order in which they are evaluated.
Questions:
- In which cases a comma
,
token is interpreted as an operator and in which as a separator? - When we have one line multiple statements/expressions separated by comma what's the order of evaluation for either the case of the comma operator and the case of the comma separator?