Skip to content

Commit 888b051

Browse files
AlisdairMtkoeppe
authored andcommitted
[basic.pre] Defragment specification of names and entities
The current contents of [basic.pre] jump between specifying different things. This PR moves all the specification of names to the front, followed by the specification of entities. There are two main benefits: (1) the specification for when two names are the same is a list of 4 rules that correspond to the 4 things than can form a name --- the connection is much clearer when the paragraphs are adjacent and the list is sorted to the same order; (2) in this form, even though all the words are the same, the reordering and merging of paragraphs a fit on a single page. The very last paragraph was forced over a page-break in the original layout.
1 parent 70abf30 commit 888b051

File tree

1 file changed

+37
-38
lines changed

1 file changed

+37
-38
lines changed

source/basic.tex

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
\gramSec[gram.basic]{Basics}
55

66
\rSec1[basic.pre]{Preamble}
7+
\indextext{type}%
8+
\indextext{object}%
9+
\indextext{storage class}%
10+
\indextext{scope}%
11+
\indextext{linkage}%
712

813
\pnum
914
\begin{note}
@@ -27,22 +32,22 @@
2732
\end{note}
2833

2934
\pnum
30-
\indextext{type}%
31-
\indextext{object}%
32-
\indextext{storage class}%
33-
\indextext{scope}%
34-
\indextext{linkage}%
35-
An \defn{entity} is a value, object, reference,
36-
structured binding,
37-
function, enumerator, type,
38-
class member, bit-field, template, template specialization, namespace, or
39-
pack.
35+
A \defn{name} is an \grammarterm{identifier}\iref{lex.name},
36+
\grammarterm{conversion-function-id}\iref{class.conv.fct},
37+
\grammarterm{operator-function-id}\iref{over.oper}, or
38+
\grammarterm{literal-operator-id}\iref{over.literal}.
4039

4140
\pnum
42-
A \defn{name} is an \grammarterm{identifier}\iref{lex.name},
43-
\grammarterm{operator-function-id}\iref{over.oper},
44-
\grammarterm{literal-operator-id}\iref{over.literal}, or
45-
\grammarterm{conversion-function-id}\iref{class.conv.fct}.
41+
Two names are \defnx{the same}{name!same} if
42+
\begin{itemize}
43+
\item they are \grammarterm{identifier}{s} composed of the same character sequence, or
44+
\item they are \grammarterm{conversion-function-id}{s} formed with
45+
equivalent\iref{temp.over.link} types, or
46+
\item they are \grammarterm{operator-function-id}{s} formed with
47+
the same operator, or
48+
\item they are \grammarterm{literal-operator-id}{s} formed with
49+
the same literal suffix identifier.
50+
\end{itemize}
4651

4752
\pnum
4853
Every name is introduced by a \defn{declaration}, which is a
@@ -85,44 +90,38 @@
8590
The interpretation of a \grammarterm{for-range-declaration} produces
8691
one or more of the above\iref{stmt.ranged}.
8792
\end{note}
88-
An entity $E$ is denoted by the name (if any)
89-
that is introduced by a declaration of $E$ or
90-
by a \grammarterm{typedef-name} introduced by a declaration specifying $E$.
93+
94+
\pnum
95+
\begin{note}
96+
Some names denote types or templates.
97+
In general, whenever a name is encountered
98+
it is necessary to look it up\iref{basic.lookup}
99+
to determine whether that name denotes one of these entities
100+
before continuing to parse the program that contains it.
101+
\end{note}
91102

92103
\pnum
93104
A \defn{variable} is introduced by the
94105
declaration of
95106
a reference other than a non-static data member or of
96107
an object. The variable's name, if any, denotes the reference or object.
97108

109+
\pnum
110+
An \defn{entity} is a value, object, reference,
111+
structured binding,
112+
function, enumerator, type,
113+
class member, bit-field, template, template specialization, namespace, or
114+
pack. An entity $E$ is denoted by the name (if any)
115+
that is introduced by a declaration of $E$ or
116+
by a \grammarterm{typedef-name} introduced by a declaration specifying $E$.
117+
98118
\pnum
99119
A \defnadj{local}{entity} is a variable with
100120
automatic storage duration\iref{basic.stc.auto},
101121
a structured binding\iref{dcl.struct.bind}
102122
whose corresponding variable is such an entity,
103123
or the \tcode{*\keyword{this}} object\iref{expr.prim.this}.
104124

105-
\pnum
106-
\begin{note}
107-
Some names denote types or templates.
108-
In general, whenever a name is encountered
109-
it is necessary to look it up\iref{basic.lookup}
110-
to determine whether that name denotes one of these entities
111-
before continuing to parse the program that contains it.
112-
\end{note}
113-
114-
\pnum
115-
Two names are \defnx{the same}{name!same} if
116-
\begin{itemize}
117-
\item they are \grammarterm{identifier}{s} composed of the same character sequence, or
118-
\item they are \grammarterm{operator-function-id}{s} formed with
119-
the same operator, or
120-
\item they are \grammarterm{conversion-function-id}{s} formed
121-
with equivalent\iref{temp.over.link} types, or
122-
\item they are \grammarterm{literal-operator-id}{s}\iref{over.literal} formed with
123-
the same literal suffix identifier.
124-
\end{itemize}
125-
126125
\pnum
127126
\indextext{translation unit!name and}%
128127
\indextext{linkage}%

0 commit comments

Comments
 (0)