Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove \tcode from 'const object'. #1602

Merged
merged 2 commits into from
Nov 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@
template specialization\iref{temp.over}, except that a name can refer to
\begin{itemize}
\item
a non-volatile \tcode{const} object with internal or no linkage if the object
a non-volatile const object with internal or no linkage if the object
\begin{itemize}
\item has the same literal type in all definitions of \tcode{D},
\item is initialized with a constant expression\iref{expr.const},
Expand Down Expand Up @@ -2926,9 +2926,9 @@
\end{example}

\pnum
Creating a new object within the storage that a \tcode{const} complete
Creating a new object within the storage that a const complete
object with static, thread, or automatic storage duration occupies,
or within the storage that such a \tcode{const} object used to occupy before
or within the storage that such a const object used to occupy before
its lifetime ended, results in undefined behavior.
\begin{example}
\begin{codeblock}
Expand Down
8 changes: 4 additions & 4 deletions source/compatibility.tex
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@
\change A name of file scope that is explicitly declared \tcode{const}, and not explicitly
declared \tcode{extern}, has internal linkage, while in C it would have external linkage.
\rationale
Because \tcode{const} objects may be used as values during translation in
Because const objects may be used as values during translation in
\Cpp, this feature urges programmers to provide an explicit initializer
for each \tcode{const} object.
This feature allows the user to put \tcode{const} objects in source files that are included
for each const object.
This feature allows the user to put const objects in source files that are included
in more than one translation unit.
\effect
Change to semantics of well-defined feature.
Expand Down Expand Up @@ -422,7 +422,7 @@
Seldom.

\ref{dcl.type} [see also \ref{basic.link}]
\change \tcode{const} objects must be initialized in \Cpp but can be left uninitialized in C.
\change const objects must be initialized in \Cpp but can be left uninitialized in C.
\rationale
A const object cannot be assigned to so it must be initialized
to hold a useful value.
Expand Down
4 changes: 2 additions & 2 deletions source/conversions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
\begin{note}
If a program could assign a pointer of type \tcode{T**} to a pointer of
type \tcode{const} \tcode{T**} (that is, if line \#1 below were
allowed), a program could inadvertently modify a \tcode{const} object
allowed), a program could inadvertently modify a const object
(as it is done on line \#2). For example,

\begin{codeblock}
Expand All @@ -307,7 +307,7 @@
char* pc;
const char** pcc = &pc; // \#1: not allowed
*pcc = &c;
*pc = 'C'; // \#2: modifies a \tcode{const} object
*pc = 'C'; // \#2: modifies a const object
}
\end{codeblock}
\end{note}
Expand Down
14 changes: 7 additions & 7 deletions source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
The \tcode{mutable} specifier on a class data member nullifies a
\tcode{const} specifier applied to the containing class object and
permits modification of the mutable class member even though the rest of
the object is \tcode{const}\iref{dcl.type.cv}.
the object is const\iref{dcl.type.cv}.

\rSec2[dcl.fct.spec]{Function specifiers}%
\indextext{specifier!function}%
Expand Down Expand Up @@ -943,7 +943,7 @@

\pnum
A \tcode{constexpr} specifier used in an object declaration
declares the object as \tcode{const}.
declares the object as const.
Such an object
shall have literal type and
shall be initialized.
Expand Down Expand Up @@ -1154,9 +1154,9 @@
\end{note}

\pnum
\indextext{const object@\tcode{const}-object!undefined change to}%
\indextext{const object!undefined change to}%
Except that any class member declared \tcode{mutable}\iref{dcl.stc}
can be modified, any attempt to modify a \tcode{const} object during its
can be modified, any attempt to modify a const object during its
lifetime\iref{basic.life} results in undefined behavior.
\begin{example}
\begin{codeblock}
Expand All @@ -1170,11 +1170,11 @@

int* ip;
ip = const_cast<int*>(cip); // cast needed to convert \tcode{const int*} to \tcode{int*}
*ip = 4; // defined: \tcode{*ip} points to \tcode{i}, a non-\tcode{const} object
*ip = 4; // defined: \tcode{*ip} points to \tcode{i}, a non-const object

const int* ciq = new const int (3); // initialized as required
int* iq = const_cast<int*>(ciq); // cast required
*iq = 4; // undefined: modifies a \tcode{const} object
*iq = 4; // undefined: modifies a const object
\end{codeblock}
For another example,
\begin{codeblock}
Expand All @@ -1192,7 +1192,7 @@
y.x.j++; // ill-formed: const-qualified member modified
Y* p = const_cast<Y*>(&y); // cast away const-ness of \tcode{y}
p->x.i = 99; // well-formed: \tcode{mutable} member can be modified
p->x.j = 99; // undefined: modifies a \tcode{const} member
p->x.j = 99; // undefined: modifies a const subobject
\end{codeblock}
\end{example}

Expand Down
4 changes: 2 additions & 2 deletions source/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4525,7 +4525,7 @@
\tcode{E1.E2} given in~\ref{expr.ref}.
\begin{note}
It is not possible to use a pointer to member that refers to a
\tcode{mutable} member to modify a \tcode{const} class object. For
\tcode{mutable} member to modify a const class object. For
example,

\begin{codeblock}
Expand All @@ -4537,7 +4537,7 @@
{
const S cs;
int S::* pm = &S::i; // \tcode{pm} refers to \tcode{mutable} member \tcode{S::i}
cs.*pm = 88; // ill-formed: \tcode{cs} is a \tcode{const} object
cs.*pm = 88; // ill-formed: \tcode{cs} is a const object
}
\end{codeblock}
\end{note}
Expand Down
2 changes: 1 addition & 1 deletion source/intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@
\pnum
Certain other operations are described in this document as
undefined (for example, the effect of
attempting to modify a \tcode{const} object).
attempting to modify a const object).
\begin{note} This document imposes no requirements on the
behavior of programs that contain undefined behavior. \end{note}

Expand Down
2 changes: 1 addition & 1 deletion source/templates.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4148,7 +4148,7 @@
\item constant expression evaluation\iref{expr.const} within the template
instantiation uses
\begin{itemize}
\item the value of a \tcode{const} object of integral or unscoped enumeration type or
\item the value of a const object of integral or unscoped enumeration type or
\item the value of a \tcode{constexpr} object or
\item the value of a reference or
\item the definition of a constexpr function,
Expand Down