Skip to content

Commit be3e611

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 e4a7f6d commit be3e611

File tree

4 files changed

+15
-20
lines changed

4 files changed

+15
-20
lines changed

source/basic.tex

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2870,24 +2870,10 @@
28702870
\end{note}
28712871
\indextext{splice|)}
28722872

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

28762876
\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}%
28912877
A name has
28922878
\defnadj{external}{linkage},
28932879
\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{module.unit} 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 identifiers have external or module linkage,
208+
The separate translation units of a program communicate by (for example)
209+
calls to functions whose identifiers have external or module linkage\iref{basic.link},
205210
manipulation of objects whose identifiers have external or module linkage, or
206211
manipulation of data files.
207212
\end{note}

source/modules.tex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
\rSec1[module.unit]{Module units and purviews}
77

88
\begin{bnf}
9+
\nontermdef{translation-unit}\br
10+
\opt{declaration-seq}\br
11+
\opt{global-module-fragment} module-declaration \opt{declaration-seq} \opt{private-module-fragment}
12+
913
\nontermdef{module-declaration}\br
1014
\opt{export-keyword} module-keyword module-name \opt{module-partition} \opt{attribute-specifier-seq} \terminal{;}
1115
\end{bnf}

0 commit comments

Comments
 (0)