Skip to content

Commit 1a45c36

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 [basic.def] which contains the practical definition. Finally, retitle [basic.link] as just Linkage, rather than Programs and linkage.
1 parent cd23bd1 commit 1a45c36

File tree

4 files changed

+23
-22
lines changed

4 files changed

+23
-22
lines changed

source/basic.tex

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,16 @@
163163

164164
\rSec1[basic.def]{Declarations and definitions}
165165

166+
\pnum
167+
\indextext{translation unit}%
168+
A translation unit consists of a sequence of \grammarterm{declaration}s\iref{dcl.pre}.
169+
170+
\begin{bnf}
171+
\nontermdef{translation-unit}\br
172+
\opt{declaration-seq}\br
173+
\opt{global-module-fragment} module-declaration \opt{declaration-seq} \opt{private-module-fragment}
174+
\end{bnf}
175+
166176
\pnum
167177
\indextext{declaration!definition versus}%
168178
\indextext{declaration}%
@@ -2873,24 +2883,10 @@
28732883
\end{note}
28742884
\indextext{splice|)}
28752885

2876-
\rSec1[basic.link]{Program and linkage}%
2886+
\rSec1[basic.link]{Linkage}%
28772887
\indextext{linkage|(}
28782888

28792889
\pnum
2880-
\indextext{program}%
2881-
\indextext{linking}%
2882-
A \defn{program} consists of one or more translation units\iref{lex.separate}
2883-
linked together. A translation unit consists
2884-
of a sequence of declarations.
2885-
2886-
\begin{bnf}
2887-
\nontermdef{translation-unit}\br
2888-
\opt{declaration-seq}\br
2889-
\opt{global-module-fragment} module-declaration \opt{declaration-seq} \opt{private-module-fragment}
2890-
\end{bnf}
2891-
2892-
\pnum
2893-
\indextext{translation unit}%
28942890
A name has
28952891
\defnadj{external}{linkage},
28962892
\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+
that are translated and 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
Each preprocessing token is converted into a token\iref{lex.token}.
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
@@ -6523,8 +6523,8 @@
65236523
\end{itemize}
65246524
\begin{note}
65256525
An implicit instantiation in an importing translation unit
6526-
cannot use names with internal linkage
6527-
from an imported translation unit\iref{basic.link}.
6526+
cannot use names with internal linkage\iref{basic.link}
6527+
from an imported translation unit\iref{module.import}.
65286528
\end{note}
65296529

65306530
\pnum

0 commit comments

Comments
 (0)