Skip to content

Commit b89d085

Browse files
authored
Meaning of the postfix-expression
Fix the following problems with the current text: 1. An expression does not identify anything, it is an identifier’s job. 2. There is no such thing as a function object. 3. A reference to a callable object need not be an lvalue expression. 4. Joining some elements of an unordered list with **or** is confusing, especially when all alternatives are of equal status and importance. I also have also included several remarks that I consider would improve the reliability of the text. TO DO: 1. The examples are inconsistent. 1. Links to detailed explanations of key concepts.
1 parent aa2407a commit b89d085

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

‎docs/cpp/function-call-operator-parens.md‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,25 @@ no-loc: [ opt ]
77
---
88
# Function Call Operator: ()
99

10-
A function call is a kind of *`postfix-expression`*, formed by an expression that identifies a function followed by the function-call operator, **`()`**. An object can declare an `operator ()` function, which provides function call semantics for the object.
10+
A function call is a kind of *`postfix-expression`*, formed by an expression that evaluates to a function or some other callable object followed by the function-call operator, **`()`**. An object can declare an `operator ()` function, which provides function call semantics for the object.
1111

1212
## Syntax
1313

1414
> *`postfix-expression`*:\
15-
> &nbsp;&nbsp;&nbsp;&nbsp;*`postfix-expression`* **`(`** *`argument-expression-list`* <sub>opt</sub> **`)`**
15+
> &emsp;*`postfix-expression`* **`(`** *`argument-expression-list`* <sub>opt</sub> **`)`**
1616
1717
## Remarks
1818

1919
The arguments to the function-call operator come from an *`argument-expression-list`*, a comma-separated list of expressions. The values of these expressions are passed to the function as arguments. The *argument-expression-list* can be empty. Before C++ 17, the order of evaluation of the function expression and the argument expressions is unspecified and may occur in any order. In C++17 and later, the function expression is evaluated before any argument expressions or default arguments. The argument expressions are evaluated in an indeterminate sequence.
2020

21-
The *`postfix-expression`* identifies the function to call. It must evaluate to a function address. It can take any of several forms:
21+
The *`postfix-expression`* will evaluate to the function to be called. It can take any of several forms:
2222

23-
- a function or function object name or pointer,
24-
- an lvalue expression that refers to a function or function object,
25-
- a member function accessor, either explicit or implied.
23+
- a function identifier, visible in the current scope or in the scope of any of the function arguments provided,
24+
- an expression that evaluates to a function, a function pointer or a some other callable object, or to a reference to one,
25+
- a member function accessor, either explicit or implied,
26+
- a dereferenced pointer to a member function.
2627

27-
The function specified by the *`postfix-expression`* may be an overloaded function. The usual rules for overload resolution determine the actual function to call.
28+
The *`postfix-expression`* may consist of an overloaded function identifier or overloaded member function accessor. The rules for overload resolution determine the actual function to be called. If the member function is virtual, the function to be called will be determined at run time.
2829

2930
Some example declarations:
3031

0 commit comments

Comments
 (0)