This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

50
cppdraft/expr/comma.md Normal file
View File

@@ -0,0 +1,50 @@
[expr.comma]
# 7 Expressions [[expr]](./#expr)
## 7.6 Compound expressions [[expr.compound]](expr.compound#expr.comma)
### 7.6.20 Comma operator [expr.comma]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L8202)
The comma operator groups left-to-right[.](#1.sentence-1)
[expression:](#nt:expression "7.6.20Comma operator[expr.comma]")
[*assignment-expression*](expr.assign#nt:assignment-expression "7.6.19Assignment and compound assignment operators[expr.assign]")
[*expression*](#nt:expression "7.6.20Comma operator[expr.comma]") , [*assignment-expression*](expr.assign#nt:assignment-expression "7.6.19Assignment and compound assignment operators[expr.assign]")
A pair of expressions separated by a comma is evaluated left-to-right;
the left expression is
a [discarded-value expression](expr.prop#def:discarded-value_expression "7.2Properties of expressions[expr.prop]")[.](#1.sentence-2)
The left expression is sequenced before
the right expression ([[intro.execution]](intro.execution "6.10.1Sequential execution"))[.](#1.sentence-3)
The type and value of the
result are the type and value of the right operand; the result is of the same
value category as its right operand, and is a bit-field if its
right operand is a bit-field[.](#1.sentence-4)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L8222)
[*Note [1](#note-1)*:
In contexts where the comma token is given special meaning
(e.g., function calls ([[expr.call]](expr.call "7.6.1.3Function call")),
subscript expressions ([[expr.sub]](expr.sub "7.6.1.2Subscripting")),
lists of initializers ([[dcl.init]](dcl.init "9.5Initializers")),
or [*template-argument-list*](temp.names#nt:template-argument-list "13.3Names of template specializations[temp.names]")*s* ([[temp.names]](temp.names "13.3Names of template specializations"))),
the comma operator as described in this subclause can appear only in parentheses[.](#2.sentence-1)
[*Example [1](#example-1)*:
f(a, (t=3, t+2), c); has three arguments, the second of which has the value5[.](#2.sentence-2)
— *end example*]
— *end note*]