问题
A function produces a result, can be used as argument of another function parameter. So, is a function call like:
f(1,2,3)
be considered as an "expression"? Thanks.
回答1:
The C++ standard (N3376, §5.1) specifies an expression as:
An expression is a sequence of operators and operands that specifies a computation. An expression can result in a value and can cause side effects.
Further in the same section (§5.2.2):
A function call is a postfix expression followed by parentheses containing a possibly empty, comma-separated list of expressions which constitute the arguments to the function.
In short, yes.
回答2:
According to 5.2.2 [expr.call] paragraph 1 of ISO/IEC 14882:2014, a function call is a [postfix] expression:
A function call is a postfix expression followed by parentheses containing a possibly empty, comma-separated list of initializer-clauses which constitute the arguments to the function. ...
来源:https://stackoverflow.com/questions/38180381/is-c-function-call-an-expression