You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b89d085
Browse filesBrowse the repository at this point in the historyBrowse files
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.
Copy file name to clipboardExpand all lines: docs/cpp/function-call-operator-parens.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,24 +7,25 @@ no-loc: [ opt ]
7
7
---
8
8
# Function Call Operator: ()
9
9
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.
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.
20
20
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:
22
22
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.
26
27
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.
0 commit comments