Skip to content

Commit 290fe9c

Browse files
jensmaurertkoeppe
authored andcommitted
[std] Use \keyword for 'struct', 'class', 'union', 'enum'.
1 parent 7cb4ff8 commit 290fe9c

File tree

7 files changed

+35
-35
lines changed

7 files changed

+35
-35
lines changed

source/classes.tex

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,11 @@
255255

256256
\pnum
257257
A \defnadj{standard-layout}{struct} is a standard-layout class
258-
defined with the \grammarterm{class-key} \tcode{struct} or the
259-
\grammarterm{class-key} \tcode{class}.
258+
defined with the \grammarterm{class-key} \keyword{struct} or the
259+
\grammarterm{class-key} \keyword{class}.
260260
A \defnadj{standard-layout}{union} is a standard-layout class
261261
defined with the
262-
\grammarterm{class-key} \tcode{union}.
262+
\grammarterm{class-key} \keyword{union}.
263263

264264
\pnum
265265
\begin{note}
@@ -360,7 +360,7 @@
360360
int stat(struct stat*); // \tcode{stat} now also names a function
361361

362362
void f() {
363-
struct stat* ps; // \tcode{struct} prefix needed to name \tcode{struct stat}
363+
struct stat* ps; // \keyword{struct} prefix needed to name \tcode{struct stat}
364364
stat(ps); // call \tcode{stat} function
365365
}
366366
\end{codeblock}
@@ -432,7 +432,7 @@
432432
\end{codeblock}
433433
first specifies \tcode{A} to be the name of a class and then redefines
434434
it as the name of a pointer to an object of that class. This means that
435-
the elaborated form \tcode{class} \tcode{A} must be used to refer to the
435+
the elaborated form \keyword{class} \tcode{A} must be used to refer to the
436436
class. Such artistry with names can be confusing and is best avoided.
437437
\end{note}
438438

@@ -2942,7 +2942,7 @@
29422942

29432943
\pnum
29442944
A \defn{union} is a class defined with the \grammarterm{class-key}
2945-
\tcode{union}.
2945+
\keyword{union}.
29462946

29472947
\pnum
29482948
In a union,
@@ -3091,7 +3091,7 @@
30913091
the use of a placement \grammarterm{new-expression}.
30923092
\end{note}
30933093
\begin{example}
3094-
Consider an object \tcode{u} of a \tcode{union} type \tcode{U} having non-static data members
3094+
Consider an object \tcode{u} of a \keyword{union} type \tcode{U} having non-static data members
30953095
\tcode{m} of type \tcode{M} and \tcode{n} of type \tcode{N}. If \tcode{M} has a non-trivial
30963096
destructor and \tcode{N} has a non-trivial constructor (for instance, if they declare or inherit
30973097
virtual functions), the active member of \tcode{u} can be safely switched from \tcode{m} to
@@ -4110,12 +4110,12 @@
41104110
\indextext{default access control|see{access control, default}}%
41114111
\indextext{access control!default}%
41124112
Members of a class defined with the keyword
4113-
\tcode{class}
4113+
\keyword{class}
41144114
are
41154115
\tcode{private}
41164116
by default.
41174117
Members of a class defined with the keywords
4118-
\tcode{struct} or \tcode{union}
4118+
\keyword{struct} or \keyword{union}
41194119
are public by default.
41204120
\begin{example}
41214121
\begin{codeblock}
@@ -4278,7 +4278,7 @@
42784278
\begin{example}
42794279
\begin{codeblock}
42804280
class X {
4281-
int a; // \tcode{X::a} is private by default: \tcode{class} used
4281+
int a; // \tcode{X::a} is private by default: \keyword{class} used
42824282
public:
42834283
int b; // \tcode{X::b} is public
42844284
int c; // \tcode{X::c} is public
@@ -4291,7 +4291,7 @@
42914291
\begin{example}
42924292
\begin{codeblock}
42934293
struct S {
4294-
int a; // \tcode{S::a} is public by default: \tcode{struct} used
4294+
int a; // \tcode{S::a} is public by default: \keyword{struct} used
42954295
protected:
42964296
int b; // \tcode{S::b} is protected
42974297
private:
@@ -4383,12 +4383,12 @@
43834383
\tcode{public}
43844384
is assumed when the derived class is
43854385
defined with the \grammarterm{class-key}
4386-
\tcode{struct}
4386+
\keyword{struct}
43874387
and
43884388
\tcode{private}
43894389
is assumed when the class is
43904390
defined with the \grammarterm{class-key}
4391-
\tcode{class}.
4391+
\keyword{class}.
43924392
\begin{example}
43934393
\begin{codeblock}
43944394
class B { @\commentellip@ };

source/compatibility.tex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,7 +1910,7 @@
19101910

19111911
\diffref{basic.scope}
19121912
\change
1913-
A \tcode{struct} is a scope in \Cpp{}, not in C.
1913+
A \keyword{struct} is a scope in \Cpp{}, not in C.
19141914
For example,
19151915
\begin{codeblock}
19161916
struct X {
@@ -1926,9 +1926,9 @@
19261926
\difficulty
19271927
Semantic transformation.
19281928
\howwide
1929-
C programs use \tcode{struct} extremely frequently, but the
1930-
change is only noticeable when \tcode{struct}, enumeration, or enumerator
1931-
names are referred to outside the \tcode{struct}.
1929+
C programs use \keyword{struct} extremely frequently, but the
1930+
change is only noticeable when \keyword{struct}, enumeration, or enumerator
1931+
names are referred to outside the \keyword{struct}.
19321932
The latter is probably rare.
19331933

19341934
\diffref{basic.link} [also \ref{dcl.type}]
@@ -1965,7 +1965,7 @@
19651965
\change
19661966
C allows ``compatible types'' in several places, \Cpp{} does not.\\
19671967
For example,
1968-
otherwise-identical \tcode{struct} types with different tag names
1968+
otherwise-identical \keyword{struct} types with different tag names
19691969
are ``compatible'' in C but are distinctly different types
19701970
in \Cpp{}.
19711971
\rationale
@@ -2200,7 +2200,7 @@
22002200

22012201
\rationale
22022202
For ease of use, \Cpp{} doesn't require that a type name be prefixed
2203-
with the keywords \tcode{class}, \tcode{struct} or \tcode{union} when used in object
2203+
with the keywords \keyword{class}, \keyword{struct} or \keyword{union} when used in object
22042204
declarations or type casts.
22052205

22062206
Example:
@@ -2487,7 +2487,7 @@
24872487
can be attributed to the new \Cpp{} name space definition where a
24882488
name can be declared as a type and as a non-type in a single scope
24892489
causing the non-type name to hide the type name and requiring that
2490-
the keywords \tcode{class}, \tcode{struct}, \tcode{union} or \tcode{enum} be used to refer to the type name.
2490+
the keywords \keyword{class}, \keyword{struct}, \keyword{union} or \keyword{enum} be used to refer to the type name.
24912491
This new name space definition provides important notational
24922492
conveniences to \Cpp{} programmers and helps making the use of the
24932493
user-defined types as similar as possible to the use of fundamental

source/declarations.tex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,19 +1514,19 @@
15141514
\end{note}
15151515

15161516
\pnum
1517-
The \grammarterm{class-key} or \tcode{enum} keyword
1517+
The \grammarterm{class-key} or \keyword{enum} keyword
15181518
present in the
15191519
\grammarterm{elaborated-type-specifier} shall agree in kind with the
15201520
declaration to which the name in the
15211521
\grammarterm{elaborated-type-specifier} refers. This rule also applies to
15221522
the form of \grammarterm{elaborated-type-specifier} that declares a
15231523
\grammarterm{class-name} or friend class since it can be construed
15241524
as referring to the definition of the class. Thus, in any
1525-
\grammarterm{elaborated-type-specifier}, the \tcode{enum} keyword
1525+
\grammarterm{elaborated-type-specifier}, the \keyword{enum} keyword
15261526
shall be
1527-
used to refer to an enumeration\iref{dcl.enum}, the \tcode{union}
1527+
used to refer to an enumeration\iref{dcl.enum}, the \keyword{union}
15281528
\grammarterm{class-key} shall be used to refer to a union\iref{class.union},
1529-
and either the \tcode{class} or \tcode{struct}
1529+
and either the \keyword{class} or \keyword{struct}
15301530
\grammarterm{class-key} shall be used to refer to a non-union class\iref{class.pre}.
15311531
\begin{example}
15321532
\begin{codeblock}
@@ -6791,7 +6791,7 @@
67916791
in that \grammarterm{attribute-specifier-seq} are thereafter considered attributes of the
67926792
enumeration whenever it is named.
67936793
A \tcode{:} following
6794-
``\tcode{enum} \opt{\grammarterm{nested-name-specifier}} \grammarterm{identifier}''
6794+
``\keyword{enum} \opt{\grammarterm{nested-name-specifier}} \grammarterm{identifier}''
67956795
within the \grammarterm{decl-specifier-seq} of a \grammarterm{member-declaration}
67966796
is parsed as part of an \grammarterm{enum-base}.
67976797
\begin{note}
@@ -6818,7 +6818,7 @@
68186818
\pnum
68196819
\indextext{constant!enumeration}%
68206820
The enumeration type declared with an \grammarterm{enum-key}
6821-
of only \tcode{enum} is an \defnadj{unscoped}{enumeration},
6821+
of only \keyword{enum} is an \defnadj{unscoped}{enumeration},
68226822
and its \grammarterm{enumerator}{s} are \defnx{unscoped enumerators}{enumerator!unscoped}.
68236823
The \grammarterm{enum-key}{s} \tcode{enum class} and
68246824
\tcode{enum struct} are semantically equivalent; an enumeration
@@ -6988,7 +6988,7 @@
69886988
color c = 1; // error: type mismatch, no conversion from \tcode{int} to \tcode{color}
69896989
int i = yellow; // OK: \tcode{yellow} converted to integral value \tcode{1}, integral promotion
69906990
\end{codeblock}
6991-
Note that this implicit \tcode{enum} to \tcode{int}
6991+
Note that this implicit \keyword{enum} to \tcode{int}
69926992
conversion is not provided for a scoped enumeration:
69936993
\begin{codeblock}
69946994
enum class Col { red, yellow, green };

source/numerics.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2826,7 +2826,7 @@
28262826

28272827
\pnum
28282828
It is unspecified whether \tcode{D::param_type}
2829-
is declared as a (nested) \tcode{class}
2829+
is declared as a (nested) \keyword{class}
28302830
or via a \keyword{typedef}.
28312831
In this subclause \ref{rand},
28322832
declarations of \tcode{D::param_type}

source/templates.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258

259259
\pnum
260260
There is no semantic difference between
261-
\tcode{class}
261+
\keyword{class}
262262
and
263263
\keyword{typename}
264264
in a
@@ -284,7 +284,7 @@
284284
\end{footnote}
285285
\grammarterm{parameter-declaration}.
286286
A \grammarterm{template-parameter} of the form
287-
\tcode{class} \grammarterm{identifier} is a \grammarterm{type-parameter}.
287+
\keyword{class} \grammarterm{identifier} is a \grammarterm{type-parameter}.
288288
\begin{example}
289289
\begin{codeblock}
290290
class T { @\commentellip@ };
@@ -5868,7 +5868,7 @@
58685868
\end{codeblock}
58695869

58705870
Nothing in this example requires
5871-
\tcode{class}
5871+
\keyword{class}
58725872
\tcode{Z<double>},
58735873
\tcode{Z<int>::g()},
58745874
or

source/threads.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5998,7 +5998,7 @@
59985998
\end{codeblock}
59995999

60006000
\pnum
6001-
The \tcode{enum} type \tcode{launch} is a bitmask type\iref{bitmask.types} with
6001+
The \keyword{enum} type \tcode{launch} is a bitmask type\iref{bitmask.types} with
60026002
elements \tcode{launch::async} and \tcode{launch::deferred}.
60036003
\begin{note}
60046004
Implementations can provide bitmasks to specify restrictions on task

source/utilities.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@
11891189
\end{itemdecl}
11901190

11911191
\pnum
1192-
The \tcode{struct} \tcode{piecewise_construct_t} is an empty class type
1192+
The \keyword{struct} \tcode{piecewise_construct_t} is an empty class type
11931193
used as a unique type to disambiguate constructor and function overloading. Specifically,
11941194
\tcode{pair} has a constructor with \tcode{piecewise_construct_t} as the
11951195
first argument, immediately followed by two \tcode{tuple}\iref{tuple} arguments used
@@ -16786,7 +16786,7 @@
1678616786

1678716787
\indexlibraryglobal{is_trivially_constructible}%
1678816788
\tcode{template<class T, class... Args>}\br
16789-
\tcode{struct}\br
16789+
\keyword{struct}\br
1679016790
\tcode{is_trivially_constructible;} &
1679116791
\tcode{is_constructible_v<T,}\br
1679216792
\tcode{Args...>} is \tcode{true} and the variable
@@ -17641,7 +17641,7 @@
1764117641
\tcode{template<class, class,}
1764217642
\hspace*{2ex}\tcode{template<class> class,}
1764317643
\hspace*{2ex}\tcode{template<class> class>}
17644-
\tcode{struct}
17644+
\keyword{struct}
1764517645
\hspace*{2ex}\tcode{basic_common_reference;}
1764617646
&
1764717647
Unless this trait is specialized (as specified in Note D, below),

0 commit comments

Comments
 (0)