Function call expressions

A function call is an expression containing the function name followed by the function call operator, (). If the function has been defined to receive parameters, the values that are to be sent into the function are listed inside the parentheses of the function call operator. The argument list can contain any number of expressions separated by commas. The argument list can also be empty.

The type of a function call expression is the return type of the function. This type can either be a complete type, a reference type, or the type void.

Begin C onlyA function call is always an rvalue.End C only

Begin C++ onlyA function call belongs to one of the following value categories depending on the result type of the function:
  • An lvalue if the result type is an lvalue reference type Begin C++11 onlyor an rvalue reference to a function typeEnd C++11 only
  • Begin C++11 onlyAn xvalue if the result type is an rvalue reference to an object typeEnd C++11 only
  • A Begin C++11 only(prvalue)End C++11 only rvalue in other cases
End C++ only
Here are some examples of the function call operator:
stub()
overdue(account, date, amount)
notify(name, date + 5)
report(error, time, date, ++num)
The order of evaluation for function call arguments is not specified. In the following example:
method(sample1, batch.process--, batch.process);
the argument batch.process-- might be evaluated last, causing the last two arguments to be passed with the same value.


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us