[expr.ref]/1:
A postfix expression followed by a dot .
or an arrow ->
, optionally followed by the keyword template
(17.2),
and then followed by an id-expression, is a postfix expression. The postfix expression before the dot or arrow
is evaluated;67 the result of that evaluation, together with the id-expression, determines the result of the
entire postfix expression.
67) If the class member access expression is evaluated, the subexpression evaluation happens even if the result is unnecessary to determine the value of the entire postfix expression, for example if the id-expression denotes a static member.
Definition of footnote (Entry 1 of 2) 1 : a note of reference, explanation, or comment usually placed below the text on a printed page 2 a : one that is a relatively subordinate or minor part (as of an event, work, or field) a movement now regarded as a footnote to architectural history
This is an illustration of a footnote.1 The number “1” at the end of the previous sentence corresponds with the note below. See how it fits in the body of the text? 1 At the bottom of the page you can insert your comments about the sentence preceding the footnote.
1. What Are Footnotes? Footnotes are notes that are placed at the end of a page and used to reference parts of the text (generally using superscript numbers). Writers use footnotes for several purposes, including citations, parenthetical information, outside sources, copyright permissions, background information, and more.
The first known use of footnote was in 1711. English Language Learners Definition of footnote. : someone or something that is remembered or regarded as a minor or unimportant part of an event, work, etc.
If a member is defined as static
, then there is only one copy of that member for the class, not one copy for each instance of the class. Static members can be referenced via an instance (an object) of the class. The footnote clarifies that the expression identifying the instance is evaluated (and any side effects take place) even though you don't need to know which instance object you're accessing to know the value of the static member.
An example:
#include <iostream>
class foo {
public:
static int s;
};
int foo::s = 42;
int index() {
std::cout << "index returns 5\n";
return 5;
}
int main() {
foo arr[10];
std::cout << arr[index()].s << "\n";
}
There's only one s
object, and its value is 42
, but the expression arr[index()]
is still evaluated, even though its result isn't needed to determine the value of s
.
The output is:
index returns 5
42
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With