diff --git a/source/basic.tex b/source/basic.tex index a1b8f00cb2..b6944da554 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -160,11 +160,21 @@ \rSec1[basic.def]{Declarations and definitions} +\pnum +\indextext{translation unit}% +A translation unit consists of a sequence of declarations\iref{dcl}. + +\begin{bnf} +\nontermdef{translation-unit}\br + \opt{declaration-seq}\br + \opt{global-module-fragment} module-declaration \opt{declaration-seq} \opt{private-module-fragment} +\end{bnf} + \pnum \indextext{declaration!definition versus}% \indextext{declaration}% \indextext{declaration!name}% -A declaration\iref{dcl} may (re)introduce +A declaration may (re)introduce one or more names and/or entities into a translation unit. If so, the @@ -2870,24 +2880,10 @@ \end{note} \indextext{splice|)} -\rSec1[basic.link]{Program and linkage}% +\rSec1[basic.link]{Linkage}% \indextext{linkage|(} \pnum -\indextext{program}% -\indextext{linking}% -A \defn{program} consists of one or more translation units\iref{lex.separate} -linked together. A translation unit consists -of a sequence of declarations. - -\begin{bnf} -\nontermdef{translation-unit}\br - \opt{declaration-seq}\br - \opt{global-module-fragment} module-declaration \opt{declaration-seq} \opt{private-module-fragment} -\end{bnf} - -\pnum -\indextext{translation unit}% A name has \defnadj{external}{linkage}, \defnadj{module}{linkage}, diff --git a/source/intro.tex b/source/intro.tex index e4014b9674..d134c737e6 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -494,7 +494,7 @@ \begin{defnote} Only one definition for such a function is in effect for the duration of the program's execution, as the result of creating the program\iref{lex.phases} and resolving the -definitions of all translation units\iref{basic.link}. +definitions of all translation units. \end{defnote} \definition{required behavior}{defns.required.behavior} diff --git a/source/lex.tex b/source/lex.tex index 566aac0c0b..7a249ef5ee 100644 --- a/source/lex.tex +++ b/source/lex.tex @@ -27,8 +27,13 @@ \pnum \indextext{conventions!lexical|(}% \indextext{compilation!separate|(}% +\indextext{program}% +A \defn{program} consists of one or more translation units\iref{lex.phases} +linked together. The text of the program is kept in units called \defnx{source files}{source file} in this document. + +\pnum A source file together with all the headers\iref{headers} and source files included\iref{cpp.include} via the preprocessing directive \tcode{\#include}, less any source lines skipped by any of the @@ -40,7 +45,7 @@ \begin{note} A \Cpp{} program need not all be translated at the same time. Translation units can be separately translated and then later linked -to produce an executable program\iref{basic.link}. +to produce an executable program. \end{note} \indextext{compilation!separate|)} @@ -174,7 +179,7 @@ Whitespace characters separating tokens are no longer significant. The resulting tokens constitute a \defn{translation unit} and are syntactically and -semantically analyzed as a \grammarterm{translation-unit}\iref{basic.link} and +semantically analyzed as a \grammarterm{translation-unit}\iref{basic.def} and translated. \begin{note} The process of analyzing and translating the tokens can occasionally @@ -200,8 +205,8 @@ \end{note} \begin{note} Previously translated translation units can be preserved individually or in libraries. -The separate translation units of a program communicate\iref{basic.link} by (for example) -calls to functions whose names have external or module linkage, +The separate translation units of a program communicate by (for example) +calls to functions whose names have external or module linkage\iref{basic.link}, manipulation of variables whose names have external or module linkage, or manipulation of data files. \end{note} diff --git a/source/templates.tex b/source/templates.tex index 9ef3133aef..2f7c861a98 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -6521,8 +6521,8 @@ \end{itemize} \begin{note} An implicit instantiation in an importing translation unit -cannot use names with internal linkage -from an imported translation unit\iref{basic.link}. +cannot use names with internal linkage\iref{basic.link} +from an imported translation unit\iref{module.import}. \end{note} \pnum