From be3e611d8fc813712e0e98b015fdc667a6ddebe3 Mon Sep 17 00:00:00 2001 From: Alisdair Meredith Date: Tue, 16 Jul 2024 15:03:23 -0400 Subject: [PATCH] [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. --- source/basic.tex | 16 +--------------- source/intro.tex | 2 +- source/lex.tex | 13 +++++++++---- source/modules.tex | 4 ++++ 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index a1b8f00cb2..19263b6c9b 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -2870,24 +2870,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 7c81810132..30872e932d 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{module.unit} 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 identifiers have external or module linkage, +The separate translation units of a program communicate by (for example) +calls to functions whose identifiers have external or module linkage\iref{basic.link}, manipulation of objects whose identifiers have external or module linkage, or manipulation of data files. \end{note} diff --git a/source/modules.tex b/source/modules.tex index cfe20205b1..03373f74d5 100644 --- a/source/modules.tex +++ b/source/modules.tex @@ -6,6 +6,10 @@ \rSec1[module.unit]{Module units and purviews} \begin{bnf} +\nontermdef{translation-unit}\br + \opt{declaration-seq}\br + \opt{global-module-fragment} module-declaration \opt{declaration-seq} \opt{private-module-fragment} + \nontermdef{module-declaration}\br \opt{export-keyword} module-keyword module-name \opt{module-partition} \opt{attribute-specifier-seq} \terminal{;} \end{bnf} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy