Skip to content

Commit f75e6d9

Browse files
committed
Do not use \tcode for non-syntax.
This applies to inline, public, protected, private, and friend. Fixes #106.
1 parent e030dc8 commit f75e6d9

10 files changed

+54
-94
lines changed

source/access.tex

+22-44
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
\begin{itemize}
1313
\item
1414
\indextext{access control!\idxcode{private}}%
15-
\tcode{private};
15+
private;
1616
that is, its name can be used only by members and friends
1717
of the class in which it is declared.
1818
\item
1919
\indextext{access control!\idxcode{protected}}%
20-
\tcode{protected};
20+
protected;
2121
that is, its name can be used only by members and friends
2222
of the class in which it is declared, by classes derived from that class, and by their
2323
friends (see~\ref{class.protected}).
2424
\item
2525
\indextext{access control!\idxcode{public}}%
26-
\tcode{public};
26+
public;
2727
that is, its name can be used anywhere without access restriction.
2828
\end{itemize}
2929

@@ -44,12 +44,8 @@
4444
\tcode{private}
4545
by default.
4646
Members of a class defined with the keywords
47-
\tcode{struct}
48-
or
49-
\tcode{union}
50-
are
51-
\tcode{public}
52-
by default.
47+
\tcode{struct} or \tcode{union}
48+
are public by default.
5349
\begin{example}
5450

5551
\begin{codeblock}
@@ -68,8 +64,7 @@
6864
referred to from declarations or expressions.
6965
\begin{note}
7066
Access control applies to names nominated by
71-
\tcode{friend}
72-
declarations~(\ref{class.friend}) and
67+
friend declarations~(\ref{class.friend}) and
7368
\grammarterm{using-declaration}{s}~(\ref{namespace.udecl}).
7469
\end{note}
7570
In the case of overloaded function names, access control is applied to
@@ -289,35 +284,23 @@
289284
If a class is declared to be a base class (Clause~\ref{class.derived}) for another class using the
290285
\tcode{public}
291286
access specifier, the
292-
\tcode{public}
293-
members of the base class are accessible as
294-
\tcode{public}
295-
members of the derived class and
296-
\tcode{protected}
297-
members of the base class are accessible as
298-
\tcode{protected}
299-
members of the derived class.
287+
public members of the base class are accessible as
288+
public members of the derived class and
289+
protected members of the base class are accessible as
290+
protected members of the derived class.
300291
If a class is declared to be a base class for another class using the
301292
\tcode{protected}
302293
access specifier, the
303-
\tcode{public}
304-
and
305-
\tcode{protected}
306-
members of the base class are accessible as
307-
\tcode{protected}
308-
members of the derived class.
294+
public and protected members of the base class are accessible as
295+
protected members of the derived class.
309296
If a class is declared to be a base class for another class using the
310297
\tcode{private}
311298
access specifier, the
312-
\tcode{public}
313-
and
314-
\tcode{protected}
299+
public and protected
315300
members of the base class are accessible as
316-
\tcode{private}
317-
members of the derived class\footnote{As specified previously in Clause~\ref{class.access},
301+
private members of the derived class\footnote{As specified previously in Clause~\ref{class.access},
318302
private members of a base class remain inaccessible even to derived classes
319-
unless
320-
\tcode{friend}
303+
unless friend
321304
declarations within the base class definition are used to grant access explicitly.}.
322305

323306
\pnum
@@ -673,7 +656,7 @@
673656
\end{example}
674657

675658
\pnum
676-
A \tcode{friend} declaration that does not declare a function
659+
A friend declaration that does not declare a function
677660
shall have one of the following forms:
678661

679662
\begin{ncsimplebnf}
@@ -682,12 +665,12 @@
682665
\terminal{friend} typename-specifier \terminal{;}
683666
\end{ncsimplebnf}
684667

685-
\begin{note} A \tcode{friend} declaration may be the
668+
\begin{note} A friend declaration may be the
686669
\term{declaration} in a \grammarterm{template-declaration}
687670
(Clause~\ref{temp}, \ref{temp.friend}).\end{note} If the
688-
type specifier in a \tcode{friend} declaration designates a (possibly
671+
type specifier in a friend declaration designates a (possibly
689672
cv-qualified) class type, that class is declared as a friend; otherwise, the
690-
\tcode{friend} declaration is ignored. \begin{example}
673+
friend declaration is ignored. \begin{example}
691674

692675
\begin{codeblock}
693676
class C;
@@ -720,8 +703,7 @@
720703

721704
\pnum
722705
\indextext{declaration!overloaded name and \tcode{friend}}%
723-
When a
724-
\tcode{friend}
706+
When a friend
725707
declaration refers to an overloaded name or operator, only the function specified
726708
by the parameter types becomes a friend.
727709
A member function of a class
@@ -758,8 +740,7 @@
758740

759741
\pnum
760742
Such a function is implicitly an inline function~(\ref{dcl.inline}).
761-
A
762-
\tcode{friend}
743+
A friend
763744
function defined in a class is in the (lexical) scope of the class in which it is defined.
764745
A friend function defined outside the class is not~(\ref{basic.lookup.unqual}).
765746

@@ -776,10 +757,7 @@
776757
class containing the friend declaration.
777758
The meaning of the friend declaration is the same whether the friend declaration
778759
appears in the
779-
\tcode{private},
780-
\tcode{protected}
781-
or
782-
\tcode{public}~(\ref{class.mem})
760+
private, protected, or public~(\ref{class.mem})
783761
portion of the class
784762
\grammarterm{member-specification}.
785763

source/basic.tex

+5-5
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@
12571257
\end{example}
12581258
\begin{note}
12591259
When looking for a prior declaration of a class
1260-
or function introduced by a \tcode{friend} declaration, scopes outside
1260+
or function introduced by a friend declaration, scopes outside
12611261
of the innermost enclosing namespace scope are not considered;
12621262
see~\ref{namespace.memdef}. \end{note} \begin{note} \ref{basic.scope.class}
12631263
further describes the restrictions on the use of names in a class
@@ -1337,16 +1337,16 @@
13371337
definitions. \end{note}
13381338

13391339
\pnum
1340-
Name lookup for a name used in the definition of a \tcode{friend}
1340+
Name lookup for a name used in the definition of a friend
13411341
function~(\ref{class.friend}) defined inline in the class granting
13421342
friendship shall proceed as described for lookup in member function
1343-
definitions. If the \tcode{friend} function is not defined in the class
1344-
granting friendship, name lookup in the \tcode{friend} function
1343+
definitions. If the friend function is not defined in the class
1344+
granting friendship, name lookup in the friend function
13451345
definition shall proceed as described for lookup in namespace member
13461346
function definitions.
13471347

13481348
\pnum
1349-
In a \tcode{friend} declaration naming a member function, a name used in
1349+
In a friend declaration naming a member function, a name used in
13501350
the function declarator and not part of a \grammarterm{template-argument}
13511351
in the \grammarterm{declarator-id} is first looked up in the scope of the
13521352
member function's class~(\ref{class.member.lookup}). If it is not found,

source/classes.tex

+7-7
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@
384384
friend Vector operator*(const Matrix&, const Vector&);
385385
};
386386
\end{codeblock}
387-
Declaration of \tcode{friend}s is described in~\ref{class.friend},
387+
Declaration of friends is described in~\ref{class.friend},
388388
operator functions in~\ref{over.oper}.
389389
\end{example}
390390
\end{note}
@@ -619,10 +619,10 @@
619619
The
620620
\grammarterm{member-declarator-list} can be omitted only after a
621621
\grammarterm{class-specifier} or an \grammarterm{enum-specifier} or in a
622-
\tcode{friend} declaration~(\ref{class.friend}). A
622+
friend declaration~(\ref{class.friend}). A
623623
\grammarterm{pure-specifier} shall be used only in the declaration of a
624624
virtual function~(\ref{class.virtual})
625-
that is not a \tcode{friend} declaration.
625+
that is not a friend declaration.
626626

627627
\pnum
628628
The optional \grammarterm{attribute-specifier-seq} in a \grammarterm{member-declaration}
@@ -831,7 +831,7 @@
831831
\begin{note}
832832
There can be at most one definition of a non-inline member function in
833833
a program. There may be more than one
834-
\tcode{inline} member function definition in a program.
834+
inline member function definition in a program.
835835
See~\ref{basic.def.odr} and~\ref{dcl.inline}.
836836
\end{note}
837837

@@ -869,11 +869,11 @@
869869
\pnum
870870
\begin{note}
871871
A \tcode{static} local variable or local type in a member function always refers to
872-
the same entity, whether or not the member function is \tcode{inline}.
872+
the same entity, whether or not the member function is inline.
873873
\end{note}
874874

875875
\pnum
876-
Previously declared member functions may be mentioned in \tcode{friend} declarations.
876+
Previously declared member functions may be mentioned in friend declarations.
877877

878878
\pnum
879879
\indextext{local class!member function in}%
@@ -1705,7 +1705,7 @@
17051705
allowed in a declaration of an anonymous union in a class scope.
17061706
\indextext{access control!anonymous \tcode{union}}%
17071707
\indextext{restriction!anonymous \tcode{union}}%
1708-
An anonymous union shall not have \tcode{private} or \tcode{protected}
1708+
An anonymous union shall not have private or protected
17091709
members (Clause~\ref{class.access}). An anonymous union shall not have
17101710
member functions.
17111711

source/declarations.tex

+5-5
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@
15191519
declaration to which the name in the
15201520
\grammarterm{elaborated-type-specifier} refers. This rule also applies to
15211521
the form of \grammarterm{elaborated-type-specifier} that declares a
1522-
\grammarterm{class-name} or \tcode{friend} class since it can be construed
1522+
\grammarterm{class-name} or friend class since it can be construed
15231523
as referring to the definition of the class. Thus, in any
15241524
\grammarterm{elaborated-type-specifier}, the \tcode{enum} keyword
15251525
shall be
@@ -2526,10 +2526,10 @@
25262526
\end{example}
25272527

25282528
\pnum
2529-
If a \tcode{friend} declaration in a non-local class first declares a
2529+
If a friend declaration in a non-local class first declares a
25302530
class, function, class template or function template\footnote{this implies that the name of the class or function is unqualified.}
25312531
the friend is a member of the innermost enclosing
2532-
namespace. The \tcode{friend} declaration does not by itself make the name
2532+
namespace. The friend declaration does not by itself make the name
25332533
visible to unqualified lookup~(\ref{basic.lookup.unqual}) or qualified
25342534
lookup~(\ref{basic.lookup.qual}). \begin{note} The name of the friend will be
25352535
visible in its namespace if a matching declaration is provided at namespace
@@ -2539,12 +2539,12 @@
25392539
name lookup that considers functions from namespaces and classes
25402540
associated with the types of the function
25412541
arguments~(\ref{basic.lookup.argdep}). If the
2542-
name in a \tcode{friend} declaration is neither qualified nor a
2542+
name in a friend declaration is neither qualified nor a
25432543
\grammarterm{template-id} and the declaration is a function or an
25442544
\grammarterm{elaborated-type-specifier}, the lookup to determine whether
25452545
the entity has been previously declared shall not consider any scopes
25462546
outside the innermost enclosing namespace. \begin{note} The other forms of
2547-
\tcode{friend} declarations cannot declare a new member of the innermost
2547+
friend declarations cannot declare a new member of the innermost
25482548
enclosing namespace and thus follow the usual lookup rules.
25492549
\end{note}
25502550
\begin{example}

source/derived.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@
786786
cannot be a non-member~(\ref{dcl.fct.spec}) function. Nor can a virtual
787787
function be a static member, since a virtual function call relies on a
788788
specific object for determining which function to invoke. A virtual
789-
function declared in one class can be declared a \tcode{friend} in
789+
function declared in one class can be declared a friend~(\ref{class.friend}) in
790790
another class.
791791
\end{note}
792792

source/expressions.tex

+4-4
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@
941941
A member of a closure type shall not be
942942
explicitly instantiated~(\ref{temp.explicit}),
943943
explicitly specialized~(\ref{temp.expl.spec}), or
944-
named in a \tcode{friend} declaration~(\ref{class.friend}).
944+
named in a friend declaration~(\ref{class.friend}).
945945

946946
\rSec3[expr.prim.lambda.capture]{Captures}%
947947

@@ -2065,14 +2065,14 @@
20652065

20662066
\begin{itemize}
20672067
\item If, in the most derived object pointed (referred) to by \tcode{v},
2068-
\tcode{v} points (refers) to a \tcode{public} base class subobject of a
2068+
\tcode{v} points (refers) to a public base class subobject of a
20692069
\tcode{C} object, and if only one object of type \tcode{C} is derived
20702070
from the subobject pointed (referred) to by \tcode{v} the result points (refers) to that \tcode{C} object.
20712071

2072-
\item Otherwise, if \tcode{v} points (refers) to a \tcode{public} base
2072+
\item Otherwise, if \tcode{v} points (refers) to a public base
20732073
class subobject of the most derived object, and the type of the most
20742074
derived object has a base class, of type \tcode{C}, that is unambiguous
2075-
and \tcode{public}, the result points (refers) to the
2075+
and public, the result points (refers) to the
20762076
\tcode{C} subobject of the most derived object.
20772077

20782078
\item Otherwise, the

source/lib-intro.tex

+3-4
Original file line numberDiff line numberDiff line change
@@ -2694,7 +2694,7 @@
26942694
It is unspecified whether any
26952695
non-member
26962696
functions in the \Cpp standard library are defined as
2697-
\tcode{inline}~(\ref{dcl.inline}).
2697+
inline~(\ref{dcl.inline}).
26982698

26992699
\pnum
27002700
A call to a non-member function signature
@@ -2734,7 +2734,7 @@
27342734

27352735
\pnum
27362736
It is unspecified whether any member functions in the \Cpp standard library are defined as
2737-
\tcode{inline}~(\ref{dcl.inline}).
2737+
inline~(\ref{dcl.inline}).
27382738

27392739
\pnum
27402740
For a non-virtual member function described in the \Cpp standard library,
@@ -2843,8 +2843,7 @@
28432843
\indextext{protection}%
28442844
It is unspecified whether any function signature or class described in
28452845
Clauses~\ref{\firstlibchapter} through~\ref{\lastlibchapter} and Annex~\ref{depr} is a
2846-
\tcode{friend}
2847-
of another class in the \Cpp standard library.
2846+
friend of another class in the \Cpp standard library.
28482847
\indextext{specifier!\idxcode{friend}}
28492848

28502849
\rSec3[derivation]{Derived classes}

source/locales.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,7 @@
15851585
is provided so that the member functions on type
15861586
\tcode{char}
15871587
can be implemented
1588-
\tcode{inline}.\footnote{Only the
1588+
inline.\footnote{Only the
15891589
\tcode{char}
15901590
(not
15911591
\tcode{unsigned char}

source/numerics.tex

-6
Original file line numberDiff line numberDiff line change
@@ -6752,12 +6752,6 @@
67526752
matrix class nor a field class.
67536753
However, it is a very useful building block for designing such classes.}
67546754

6755-
\pnum
6756-
An implementation is permitted to qualify any of the functions declared in
6757-
\tcode{<valarray>}
6758-
as
6759-
\tcode{inline}.
6760-
67616755
\rSec3[valarray.cons]{\tcode{valarray} constructors}
67626756

67636757
\indexlibrary{\idxcode{valarray}!constructor}%

0 commit comments

Comments
 (0)