Re: comma operator



Keith Thompson said:

Richard Heathfield <rjh@xxxxxxxxxxxxxxx> writes:
Willem said:
Richard Heathfield wrote:
) Yes, it does. An expression is "a sequence of operators and
) operands that specifies computation of a value, or that
) designates an object or a function, or that generates side
) effects, or that performs a combination thereof". A comma
) operator always terminates such a sequence.

So, what would you call this then:

((1, 2, 3) + (4, 5, 6))

I would call 1 an expression, which is terminated by a comma
operator.
[...]

I would call 1 an expression. But I wouldn't call it "a sequence
of
operators and operands".

I would. It's a sequence of 1 operand and 0 operators. (There was a
discussion along similar lines recently, either here or in
comp.programming - something to do with the difference between zero
hamburgers and no hamburger. I don't recall that a satisfactory
conclusion was reached in that discussion.)

Here it's an operand of the comma
operator, but in isolation:

1;

there are no operators, and therefore 1 is not an operand.

Well, that's certainly a compelling argument. Or at least, it would
be, if you passed it to a function. :-)

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.



Relevant Pages

  • Re: Multiple Assignment Evaluation Debate
    ... Operands are ... I think he's confused about sequence points. ... we see the standard claim that the postfix increment ... The first quote here is defining the semantics of the abstract machine. ...
    (comp.lang.c)
  • Re: sequence points in subexpressions
    ... because "evaluation" is two things: ... occur until a sequence point.) ... We have two side effects in the assignment and the ++. ... we know that the value computations of the operands to + are ...
    (comp.lang.c)
  • Re: Multiple Assignment Evaluation Debate
    ... Operands are ... I think he's confused about sequence points. ... we see the standard claim that the postfix increment ... 60)This paragraph renders undefined statement expressions ...
    (comp.lang.c)
  • Re: comma operator
    ... operator always terminates such a) sequence. ... I would call 1 an expression, which is terminated by a comma ... operators and operands". ...
    (comp.lang.c)
  • Re: Does this program have undefined behavior?
    ... does not constrain the order of evaluation of the assignment's ... to i and no sequence points (related to the assignment) between them. ... sequenced after the value computations of the left and right operands. ...
    (comp.lang.c)