Skip to content

Commit 700fb90

Browse files
committed
[std] Use \keyword for 'for', 'do', 'while', 'switch', 'case', 'if', 'else'.
1 parent 212b655 commit 700fb90

File tree

7 files changed

+54
-54
lines changed

7 files changed

+54
-54
lines changed

source/basic.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@
10971097

10981098
\pnum
10991099
The locus of a \grammarterm{for-range-declaration}
1100-
of a range-based \tcode{for} statement\iref{stmt.ranged}
1100+
of a range-based \keyword{for} statement\iref{stmt.ranged}
11011101
is immediately after the \grammarterm{for-range-initializer}.
11021102

11031103
\pnum

source/declarations.tex

+2-2
Original file line numberDiff line numberDiff line change
@@ -8623,10 +8623,10 @@
86238623
shall appear at most once in each \grammarterm{attribute-list} and
86248624
no \grammarterm{attribute-argument-clause} shall be present.
86258625
A fallthrough statement may only appear within
8626-
an enclosing \tcode{switch} statement\iref{stmt.switch}.
8626+
an enclosing \keyword{switch} statement\iref{stmt.switch}.
86278627
The next statement that would be executed after a fallthrough statement
86288628
shall be a labeled statement whose label is a case label or
8629-
default label for the same \tcode{switch} statement and,
8629+
default label for the same \keyword{switch} statement and,
86308630
if the fallthrough statement is contained in an iteration statement,
86318631
the next statement shall be part of the same execution of
86328632
the substatement of the innermost enclosing iteration statement.

source/exceptions.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
\indextext{\idxcode{switch}!and try block}%
7373
\indextext{\idxcode{goto}!and handler}%
7474
\indextext{\idxcode{switch}!and handler}%
75-
A \tcode{goto} or \tcode{switch} statement shall not be used to transfer control
75+
A \tcode{goto} or \keyword{switch} statement shall not be used to transfer control
7676
into a try block or into a handler.
7777
\begin{example}
7878
\begin{codeblock}

source/limits.tex

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@
6969
files\iref{cpp.include} [256].
7070
\item%
7171
Case labels for a
72-
\tcode{switch}
72+
\keyword{switch}
7373
statement\iref{stmt.switch} (excluding those for any nested
74-
\tcode{switch}
74+
\keyword{switch}
7575
statements)
7676
[16\,384].
7777
\item%

source/numerics.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@
12321232
\indextext{literal!complex}%
12331233
\pnum
12341234
This subclause describes literal suffixes for constructing complex number literals.
1235-
The suffixes \tcode{i}, \tcode{il}, and \tcode{if} create complex numbers of
1235+
The suffixes \tcode{i}, \tcode{il}, and \keyword{if} create complex numbers of
12361236
the types \tcode{complex<double>}, \tcode{complex<long double>}, and
12371237
\tcode{complex<float>} respectively, with their imaginary part denoted by the
12381238
given literal number and the real part being zero.

source/preprocessor.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@
494494
Thus, the constant expression in the following
495495
\tcode{\#if}
496496
directive and
497-
\tcode{if} statement\iref{stmt.if}
497+
\keyword{if} statement\iref{stmt.if}
498498
is not guaranteed to evaluate to the same value in these two
499499
contexts:
500500
\begin{codeblock}

source/statements.tex

+46-46
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
\pnum
7878
\indextext{\idxgram{condition}{s}!rules for}%
7979
The rules for \grammarterm{condition}{s} apply both to
80-
\grammarterm{selection-statement}{s} and to the \tcode{for} and \tcode{while}
80+
\grammarterm{selection-statement}{s} and to the \keyword{for} and \keyword{while}
8181
statements\iref{stmt.iter}.
8282
A \grammarterm{condition} that is not an \grammarterm{expression} is a
8383
declaration\iref{dcl.dcl}.
@@ -89,19 +89,19 @@
8989

9090
\pnum
9191
The value of a \grammarterm{condition} that is an initialized declaration
92-
in a statement other than a \tcode{switch} statement is the value of the
92+
in a statement other than a \keyword{switch} statement is the value of the
9393
declared variable
9494
contextually converted to \tcode{bool}\iref{conv}.
9595
If that
9696
conversion is ill-formed, the program is ill-formed. The value of a
9797
\grammarterm{condition} that is an initialized declaration in a
98-
\tcode{switch} statement is the value of the declared variable if it has
98+
\keyword{switch} statement is the value of the declared variable if it has
9999
integral or enumeration type, or of that variable implicitly converted
100100
to integral or enumeration type otherwise. The value of a
101101
\grammarterm{condition} that is an expression is the value of the
102102
expression, contextually converted to \tcode{bool}
103103
for statements other
104-
than \tcode{switch};
104+
than \keyword{switch};
105105
if that conversion is ill-formed, the program is
106106
ill-formed. The value of the condition will be referred to as simply
107107
``the condition'' where the usage is unambiguous.
@@ -143,7 +143,7 @@
143143
\pnum
144144
\indextext{label!\idxcode{case}}%
145145
\indextext{label!\idxcode{default}}%
146-
Case labels and default labels shall occur only in \tcode{switch} statements.
146+
Case labels and default labels shall occur only in \keyword{switch} statements.
147147

148148

149149
\rSec1[stmt.expr]{Expression statement}%
@@ -170,7 +170,7 @@
170170
Most statements are expression statements --- usually assignments or
171171
function calls. A null statement is useful to carry a label just before
172172
the \tcode{\}} of a compound statement and to supply a null body to an
173-
iteration statement such as a \tcode{while}
173+
iteration statement such as a \keyword{while}
174174
statement\iref{stmt.while}.
175175
\end{note}
176176

@@ -233,21 +233,21 @@
233233

234234
\pnum
235235
If the condition\iref{stmt.select} yields \tcode{true} the first
236-
substatement is executed. If the \tcode{else} part of the selection
236+
substatement is executed. If the \keyword{else} part of the selection
237237
statement is present and the condition yields \tcode{false}, the second
238238
substatement is executed. If the first substatement is reached via a
239239
label, the condition is not evaluated and the second substatement is
240-
not executed. In the second form of \tcode{if} statement
241-
(the one including \tcode{else}), if the first substatement is also an
242-
\tcode{if} statement then that inner \tcode{if} statement shall contain
243-
an \tcode{else} part.
240+
not executed. In the second form of \keyword{if} statement
241+
(the one including \keyword{else}), if the first substatement is also an
242+
\keyword{if} statement then that inner \tcode{if} statement shall contain
243+
an \keyword{else} part.
244244
\begin{footnote}
245-
In other words, the \tcode{else} is associated with the nearest un-elsed
246-
\tcode{if}.
245+
In other words, the \keyword{else} is associated with the nearest un-elsed
246+
\keyword{if}.
247247
\end{footnote}
248248

249249
\pnum
250-
If the \tcode{if} statement is of the form \tcode{if constexpr}, the value
250+
If the \keyword{if} statement is of the form \tcode{if constexpr}, the value
251251
of the condition shall be a contextually
252252
converted constant expression of type \tcode{bool}\iref{expr.const}; this
253253
form is called a \defn{constexpr if} statement. If the value of the
@@ -261,9 +261,9 @@
261261
Odr-uses\iref{basic.def.odr} in a discarded statement do not require
262262
an entity to be defined.
263263
\end{note}
264-
A \tcode{case} or \tcode{default} label appearing within such an
265-
\tcode{if} statement shall be associated with a \tcode{switch}
266-
statement\iref{stmt.switch} within the same \tcode{if} statement.
264+
A \keyword{case} or \keyword{default} label appearing within such an
265+
\keyword{if} statement shall be associated with a \keyword{switch}
266+
statement\iref{stmt.switch} within the same \keyword{if} statement.
267267
A label\iref{stmt.label} declared in a substatement of a constexpr if
268268
statement shall only be referred to by a statement\iref{stmt.goto} in
269269
the same substatement.
@@ -290,7 +290,7 @@
290290
\end{example}
291291

292292
\pnum
293-
An \tcode{if} statement of the form
293+
An \keyword{if} statement of the form
294294
\begin{ncsimplebnf}
295295
\keyword{if} \opt{\keyword{constexpr}} \terminal{(} init-statement condition \terminal{)} statement
296296
\end{ncsimplebnf}
@@ -301,7 +301,7 @@
301301
\bnfindent \keyword{if} \opt{\keyword{constexpr}} \terminal{(} condition \terminal{)} statement\br
302302
\terminal{\}}
303303
\end{ncsimplebnf}
304-
and an \tcode{if} statement of the form
304+
and an \keyword{if} statement of the form
305305
\begin{ncsimplebnf}
306306
\keyword{if} \opt{\keyword{constexpr}} \terminal{(} init-statement condition \terminal{)} statement \keyword{else} statement
307307
\end{ncsimplebnf}
@@ -319,7 +319,7 @@
319319
\indextext{statement!\idxcode{switch}}
320320

321321
\pnum
322-
The \tcode{switch} statement causes control to be transferred to one of
322+
The \keyword{switch} statement causes control to be transferred to one of
323323
several statements depending on the value of a condition.
324324

325325
\pnum
@@ -331,7 +331,7 @@
331331
promotions\iref{conv.prom}, the condition is converted
332332
to the promoted type.
333333
Any
334-
statement within the \tcode{switch} statement can be labeled with one or
334+
statement within the \keyword{switch} statement can be labeled with one or
335335
more case labels as follows:
336336
\begin{ncbnf}
337337
\indextext{label!\idxcode{case}}%
@@ -348,40 +348,40 @@
348348
\begin{codeblock}
349349
default :
350350
\end{codeblock}
351-
within a \tcode{switch} statement.
351+
within a \keyword{switch} statement.
352352

353353
\pnum
354-
Switch statements can be nested; a \tcode{case} or \tcode{default} label
354+
Switch statements can be nested; a \keyword{case} or \keyword{default} label
355355
is associated with the smallest switch enclosing it.
356356

357357
\pnum
358-
When the \tcode{switch} statement is executed, its condition is
358+
When the \keyword{switch} statement is executed, its condition is
359359
evaluated.
360360
\indextext{label!\idxcode{case}}%
361361
If one of the case constants has the same value as the condition,
362362
control is passed to the statement following the matched case label. If
363363
no case constant matches the condition, and if there is a
364364
\indextext{label!\idxcode{default}}%
365-
\tcode{default} label, control passes to the statement labeled by the
366-
default label. If no case matches and if there is no \tcode{default}
365+
\keyword{default} label, control passes to the statement labeled by the
366+
default label. If no case matches and if there is no \keyword{default}
367367
then none of the statements in the switch is executed.
368368

369369
\pnum
370-
\tcode{case} and \tcode{default} labels in themselves do not alter the
370+
\keyword{case} and \keyword{default} labels in themselves do not alter the
371371
flow of control, which continues unimpeded across such labels. To exit
372-
from a switch, see \tcode{break}, \ref{stmt.break}.
372+
from a switch, see \keyword{break}, \ref{stmt.break}.
373373
\begin{note}
374374
Usually, the substatement that is the subject of a switch is compound
375-
and \tcode{case} and \tcode{default} labels appear on the top-level
375+
and \keyword{case} and \keyword{default} labels appear on the top-level
376376
statements contained within the (compound) substatement, but this is not
377377
required.
378378
\indextext{statement!declaration in \tcode{switch}}%
379379
Declarations can appear in the substatement of a
380-
\tcode{switch} statement.
380+
\keyword{switch} statement.
381381
\end{note}
382382

383383
\pnum
384-
A \tcode{switch} statement of the form
384+
A \keyword{switch} statement of the form
385385
\begin{ncsimplebnf}
386386
\keyword{switch} \terminal{(} init-statement condition \terminal{)} statement
387387
\end{ncsimplebnf}
@@ -454,21 +454,21 @@
454454
int i;
455455
}
456456
\end{codeblock}
457-
Thus after the \tcode{while} statement, \tcode{i} is no longer in scope.
457+
Thus after the \keyword{while} statement, \tcode{i} is no longer in scope.
458458
\end{example}
459459

460460
\rSec2[stmt.while]{The \tcode{while} statement}%
461461
\indextext{statement!\idxcode{while}}
462462

463463
\pnum
464-
In the \tcode{while} statement the substatement is executed repeatedly
464+
In the \keyword{while} statement the substatement is executed repeatedly
465465
until the value of the condition\iref{stmt.select} becomes
466466
\tcode{false}. The test takes place before each execution of the
467467
substatement.
468468

469469
\pnum
470470
\indextext{statement!declaration in \tcode{while}}%
471-
A \tcode{while} statement is equivalent to
471+
A \keyword{while} statement is equivalent to
472472
\begin{ncsimplebnf}
473473
\exposid{label} \terminal{:}\br
474474
\terminal{\{}\br
@@ -509,15 +509,15 @@
509509
if that conversion is ill-formed, the program is ill-formed.
510510

511511
\pnum
512-
In the \tcode{do} statement the substatement is executed repeatedly
512+
In the \keyword{do} statement the substatement is executed repeatedly
513513
until the value of the expression becomes \tcode{false}. The test takes
514514
place after each execution of the statement.
515515

516516
\rSec2[stmt.for]{The \tcode{for} statement}%
517517
\indextext{statement!\idxcode{for}}
518518

519519
\pnum
520-
The \tcode{for} statement
520+
The \keyword{for} statement
521521
\begin{ncsimplebnf}
522522
\keyword{for} \terminal{(} init-statement \opt{condition} \terminal{;} \opt{expression} \terminal{)} statement
523523
\end{ncsimplebnf}
@@ -535,7 +535,7 @@
535535
in the same scope as the \grammarterm{condition}, and
536536
except that a
537537
\indextext{statement!\tcode{continue} in \tcode{for}}%
538-
\tcode{continue} in \grammarterm{statement} (not enclosed in another
538+
\keyword{continue} in \grammarterm{statement} (not enclosed in another
539539
iteration statement) will execute \grammarterm{expression} before
540540
re-evaluating \grammarterm{condition}.
541541
\begin{note}
@@ -550,14 +550,14 @@
550550
Either or both of the \grammarterm{condition}
551551
and the \grammarterm{expression} can be omitted.
552552
A missing \grammarterm{condition}
553-
makes the implied \tcode{while} clause
553+
makes the implied \keyword{while} clause
554554
equivalent to \tcode{while(true)}.
555555

556556
\rSec2[stmt.ranged]{The range-based \tcode{for} statement}%
557557
\indextext{statement!range based for@range based \tcode{for}}
558558

559559
\pnum
560-
The range-based \tcode{for} statement
560+
The range-based \keyword{for} statement
561561
\begin{ncsimplebnf}
562562
\keyword{for} \terminal{(} \opt{init-statement} for-range-declaration \terminal{:} for-range-initializer \terminal{)} statement
563563
\end{ncsimplebnf}
@@ -679,20 +679,20 @@
679679
\indextext{statement!\idxcode{break}}
680680

681681
\pnum
682-
The \tcode{break} statement shall occur only in an
682+
The \keyword{break} statement shall occur only in an
683683
\indextext{\idxgram{iteration-statement}}%
684684
\indextext{statement!\idxcode{switch}}%
685-
\grammarterm{iteration-statement} or a \tcode{switch} statement and causes
685+
\grammarterm{iteration-statement} or a \keyword{switch} statement and causes
686686
termination of the smallest enclosing \grammarterm{iteration-statement} or
687-
\tcode{switch} statement; control passes to the statement following the
687+
\keyword{switch} statement; control passes to the statement following the
688688
terminated statement, if any.
689689

690690
\rSec2[stmt.cont]{The \tcode{continue} statement}%
691691
\indextext{statement!\idxcode{continue}}
692692

693693
\pnum
694694
The
695-
\tcode{continue}
695+
\keyword{continue}
696696
statement shall occur only in an
697697
\indextext{\idxgram{iteration-statement}}%
698698
\grammarterm{iteration-statement}
@@ -731,7 +731,7 @@
731731
\end{codeblock}
732732
\end{minipage}
733733

734-
a \tcode{continue} not contained in an enclosed iteration statement is
734+
a \keyword{continue} not contained in an enclosed iteration statement is
735735
equivalent to \tcode{goto} \exposid{contin}.
736736

737737
\rSec2[stmt.return]{The \tcode{return} statement}%
@@ -893,8 +893,8 @@
893893
unless all such variables have vacuous initialization\iref{basic.life},
894894
the transfer of control shall not be a jump.
895895
\begin{footnote}
896-
The transfer from the condition of a \tcode{switch} statement to a
897-
\tcode{case} label is considered a jump in this respect.
896+
The transfer from the condition of a \keyword{switch} statement to a
897+
\keyword{case} label is considered a jump in this respect.
898898
\end{footnote}
899899
When a \grammarterm{declaration-statement} is executed,
900900
$P$ and $Q$ are the points immediately before and after it;

0 commit comments

Comments
 (0)