Skip to content

Commit 3f83595

Browse files
committed
[lex.separate][module.unit] move definitions of program and translation unit
The definition of program at the top of [basic.link] should move to the front of [lex.separate] so that it is defined before its first usage, and also clarifies that is what the phases of translation produce. Similarly, move the definition of the grammar production translation-unit to the top of the only clause whose grammar actually uses it, [module.unit]. Finally, retitle [basic.link] as just Linkage, rather than Programs and linkage.
1 parent 41014b4 commit 3f83595

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed

source/basic.tex

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,21 @@
160160

161161
\rSec1[basic.def]{Declarations and definitions}
162162

163+
\pnum
164+
\indextext{translation unit}%
165+
A translation unit consists of a sequence of declarations\iref{dcl}.
166+
167+
\begin{bnf}
168+
\nontermdef{translation-unit}\br
169+
\opt{declaration-seq}\br
170+
\opt{global-module-fragment} module-declaration \opt{declaration-seq} \opt{private-module-fragment}
171+
\end{bnf}
172+
163173
\pnum
164174
\indextext{declaration!definition versus}%
165175
\indextext{declaration}%
166176
\indextext{declaration!name}%
167-
A declaration\iref{dcl} may (re)introduce
177+
A declaration may (re)introduce
168178
one or more names and/or entities into a translation
169179
unit.
170180
If so, the
@@ -2870,24 +2880,10 @@
28702880
\end{note}
28712881
\indextext{splice|)}
28722882

2873-
\rSec1[basic.link]{Program and linkage}%
2883+
\rSec1[basic.link]{Linkage}%
28742884
\indextext{linkage|(}
28752885

28762886
\pnum
2877-
\indextext{program}%
2878-
\indextext{linking}%
2879-
A \defn{program} consists of one or more translation units\iref{lex.separate}
2880-
linked together. A translation unit consists
2881-
of a sequence of declarations.
2882-
2883-
\begin{bnf}
2884-
\nontermdef{translation-unit}\br
2885-
\opt{declaration-seq}\br
2886-
\opt{global-module-fragment} module-declaration \opt{declaration-seq} \opt{private-module-fragment}
2887-
\end{bnf}
2888-
2889-
\pnum
2890-
\indextext{translation unit}%
28912887
A name has
28922888
\defnadj{external}{linkage},
28932889
\defnadj{module}{linkage},

source/intro.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@
494494
\begin{defnote}
495495
Only one definition for such a function is in effect for the duration of the program's
496496
execution, as the result of creating the program\iref{lex.phases} and resolving the
497-
definitions of all translation units\iref{basic.link}.
497+
definitions of all translation units.
498498
\end{defnote}
499499

500500
\definition{required behavior}{defns.required.behavior}

source/lex.tex

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@
2727
\pnum
2828
\indextext{conventions!lexical|(}%
2929
\indextext{compilation!separate|(}%
30+
\indextext{program}%
31+
A \defn{program} consists of one or more translation units\iref{lex.phases}
32+
linked together.
3033
The text of the program is kept in units called
3134
\defnx{source files}{source file} in this document.
35+
36+
\pnum
3237
A source file together with all the headers\iref{headers}
3338
and source files included\iref{cpp.include} via the preprocessing
3439
directive \tcode{\#include}, less any source lines skipped by any of the
@@ -40,7 +45,7 @@
4045
\begin{note}
4146
A \Cpp{} program need not all be translated at the same time.
4247
Translation units can be separately translated and then later linked
43-
to produce an executable program\iref{basic.link}.
48+
to produce an executable program.
4449
\end{note}
4550
\indextext{compilation!separate|)}
4651

@@ -174,7 +179,7 @@
174179
Whitespace characters separating tokens are no longer significant.
175180
The resulting tokens constitute a \defn{translation unit} and
176181
are syntactically and
177-
semantically analyzed as a \grammarterm{translation-unit}\iref{basic.link} and
182+
semantically analyzed as a \grammarterm{translation-unit}\iref{basic.def} and
178183
translated.
179184
\begin{note}
180185
The process of analyzing and translating the tokens can occasionally
@@ -200,8 +205,8 @@
200205
\end{note}
201206
\begin{note}
202207
Previously translated translation units can be preserved individually or in libraries.
203-
The separate translation units of a program communicate\iref{basic.link} by (for example)
204-
calls to functions whose names have external or module linkage,
208+
The separate translation units of a program communicate by (for example)
209+
calls to functions whose names have external or module linkage\iref{basic.link},
205210
manipulation of variables whose names have external or module linkage, or
206211
manipulation of data files.
207212
\end{note}

source/templates.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6521,8 +6521,8 @@
65216521
\end{itemize}
65226522
\begin{note}
65236523
An implicit instantiation in an importing translation unit
6524-
cannot use names with internal linkage
6525-
from an imported translation unit\iref{basic.link}.
6524+
cannot use names with internal linkage\iref{basic.link}
6525+
from an imported translation unit\iref{module.import}.
65266526
\end{note}
65276527

65286528
\pnum

0 commit comments

Comments
 (0)