I am trying to understand some basics of C. KRC's The C Programming Language says
A function call is a postfix expression, called the function designator, followed by parentheses containing a possibly empty, comma-separated list of assignment expressions (Par.A7.17), which constitute the arguments to the function.
In a function call, what is the operator, and what are the operands?
Is
()
the operator?Is the function name an operand?
Are the arguments inside
()
operands?- Is a function designator a synonym of a function call?
Thanks.
In a function call,
()
is an operator just like[]
is an operator when accessing an array element.6.5.2 Postfix operators
Operand for this operator is the function name (or a pointer to the function).
No. As per the C standard the list of expressions specifies the arguments to the function.
The text in the C standard is nearly identical, 6.5.2.2:
The syntax is (6.5.2):
This means that the function name is a "postfix-expression" and the
( )
is the actual operator. The C standard does not speak of operands for this operator, but I suppose you could call the function name an operand. The argument list is not an operand, but rather a special case.The definition of a function designator is (6.3.2.1):
Meaning in the expression
func();
,func
would be the function designator but the expression as whole would be a function call. So it is not exactly the same term.Consider the example
funcptr_t f = func;
which involves the function designatorfunc
but no function call.