Skip to content

Fix forbidden words in notes and examples #7039

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions source/algorithms.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5020,7 +5020,7 @@
do not overlap.
\begin{note}
For the overload with an \tcode{ExecutionPolicy},
there might be a performance cost
there can be a performance cost
if \tcode{iterator_traits<For\-ward\-It\-er\-ator1>::value_type}
is not \oldconcept{\-Move\-Constructible} (\tref{cpp17.moveconstructible}).
\end{note}
Expand Down Expand Up @@ -5943,7 +5943,7 @@
do not overlap.
\begin{note}
For the overloads with an \tcode{ExecutionPolicy},
there might be a performance cost
there can be a performance cost
if \tcode{iterator_traits<ForwardIterator1>::value_type} does not meet
the \oldconcept{\-Move\-Constructible} (\tref{cpp17.moveconstructible}) requirements.
\end{note}
Expand Down Expand Up @@ -6130,7 +6130,7 @@
\oldconcept{CopyAssignable} requirements.
\begin{note}
For the overloads with an \tcode{ExecutionPolicy},
there might be a performance cost
there can be a performance cost
if the value type of \tcode{ForwardIterator1} does not meet both the
\oldconcept{CopyConstructible} and \oldconcept{CopyAssignable} requirements.
\end{note}
Expand Down Expand Up @@ -7717,7 +7717,7 @@

\begin{note}
For the overload with an \tcode{ExecutionPolicy},
there might be a performance cost if \tcode{first}'s value type
there can be a performance cost if \tcode{first}'s value type
does not meet the \oldconcept{CopyConstructible} requirements.
\end{note}

Expand Down
30 changes: 15 additions & 15 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@
appearing in the type of \tcode{D} can result
in the different declarations having distinct types, and
\grammarterm{lambda-expression}{s} appearing in a default argument of \tcode{D}
might still denote different types in different translation units.
can still denote different types in different translation units.
\end{note}

\pnum
Expand Down Expand Up @@ -1512,7 +1512,7 @@
any declaration in the same translation unit
whose locus\iref{basic.scope.pdecl} is before $P$.
\begin{note}
The declaration might appear in a scope that does not contain $P$.
The declaration can appear in a scope that does not contain $P$.
\end{note}
\indextext{precede|see{declaration, precede}}%
A declaration $X$ \defnx{precedes}{declaration!precede}
Expand Down Expand Up @@ -1795,7 +1795,7 @@
\pnum
\begin{note}
Even if the result of name lookup is unambiguous, use of a name found in
multiple subobjects might still be
multiple subobjects can still be
ambiguous\iref{conv.mem,expr.ref,class.access.base}.
\end{note}
\begin{example}
Expand Down Expand Up @@ -3111,7 +3111,7 @@
or a maximal sequence of adjacent bit-fields all having nonzero width.
\begin{note}
Various
features of the language, such as references and virtual functions, might
features of the language, such as references and virtual functions, can
involve additional memory locations that are not accessible to programs but are
managed by the implementation.
\end{note}
Expand Down Expand Up @@ -4270,7 +4270,7 @@
When \tcode{D} is the type of a complete object, it will have a subobject of
type \tcode{B}, so it must be aligned appropriately for a \tcode{\keyword{long} \keyword{double}}.
If \tcode{D} appears as a subobject of another object that also has \tcode{B}
as a virtual base class, the \tcode{B} subobject might be part of a different
as a virtual base class, the \tcode{B} subobject can be part of a different
subobject, reducing the alignment requirements on the \tcode{D} subobject.
\end{example}
The result of the \keyword{alignof} operator reflects the alignment
Expand Down Expand Up @@ -4583,7 +4583,7 @@

\item A temporary bound to a reference in a \grammarterm{new-initializer}\iref{expr.new} persists until the completion of the full-expression containing the \grammarterm{new-initializer}.
\begin{note}
This might introduce a dangling reference.
This can introduce a dangling reference.
\end{note}
\begin{example}
\begin{codeblock}
Expand Down Expand Up @@ -4752,7 +4752,7 @@
constexpr std::size_t N = sizeof(T);
char buf[N];
T obj; // \tcode{obj} initialized to its original value
std::memcpy(buf, &obj, N); // between these two calls to \tcode{std::memcpy}, \tcode{obj} might be modified
std::memcpy(buf, &obj, N); // between these two calls to \tcode{std::memcpy}, \tcode{obj} can be modified
std::memcpy(&obj, buf, N); // at this point, each subobject of \tcode{obj} of scalar type holds its original value
\end{codeblock}
\end{example}
Expand Down Expand Up @@ -4953,7 +4953,7 @@
\end{itemize}
\begin{note}
A literal type is one for which
it might be possible to create an object
it is possible to create an object
within a constant expression.
It is not a guarantee that it is possible to create such an object,
nor is it a guarantee that any object of that type
Expand Down Expand Up @@ -5508,7 +5508,7 @@
an invocation of a deallocation function\iref{basic.stc.dynamic.deallocation},
and \impldef{invalid pointer value in the context of an evaluation} otherwise.
\begin{footnote}
Some implementations might define that
Some implementations can define that
copying such a pointer value causes a system-generated runtime fault.
\end{footnote}
\begin{note}
Expand Down Expand Up @@ -6133,7 +6133,7 @@
initial value of the object, a value assigned to the object by $T$, or a
value assigned to the object by another thread, according to the rules below.
\begin{note}
In some cases, there might instead be undefined behavior. Much of this
In some cases, there can instead be undefined behavior. Much of this
subclause is motivated by the desire to support atomic operations with explicit
and detailed visibility constraints. However, it also implicitly supports a
simpler view for more restricted programs.
Expand Down Expand Up @@ -6500,19 +6500,19 @@
\begin{note}
Compiler transformations that introduce assignments to a potentially
shared memory location that would not be modified by the abstract machine are
generally precluded by this document, since such an assignment might overwrite
generally precluded by this document, since such an assignment can overwrite
another assignment by a different thread in cases in which an abstract machine
execution would not have encountered a data race. This includes implementations
of data member assignment that overwrite adjacent members in separate memory
locations. Reordering of atomic loads in cases in which the atomics in question
might alias is also generally precluded, since this could violate the coherence
can alias is also generally precluded, since this could violate the coherence
rules.
\end{note}

\pnum
\begin{note}
Transformations that introduce a speculative read of a potentially
shared memory location might not preserve the semantics of the \Cpp{} program as
shared memory location can not preserve the semantics of the \Cpp{} program as
defined in this document, since they potentially introduce a data race. However,
they are typically valid in the context of an optimizing compiler that targets a
specific machine with well-defined semantics for data races. They would be
Expand Down Expand Up @@ -6553,7 +6553,7 @@
a lock-free execution in that thread shall complete.
\begin{note}
Concurrently executing threads
might prevent progress of a lock-free execution.
can prevent progress of a lock-free execution.
For example,
this situation can occur
with load-locked store-conditional implementations.
Expand Down Expand Up @@ -6673,7 +6673,7 @@
guarantees, which in turn are stronger than weakly parallel forward progress
guarantees.
\begin{note}
For example, some kinds of synchronization between threads of execution might only
For example, some kinds of synchronization between threads of execution can only
make progress if the respective threads of execution provide parallel forward progress
guarantees, but will fail to make progress under weakly parallel guarantees.
\end{note}
Expand Down
18 changes: 9 additions & 9 deletions source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
\grammarterm{class-head} omits the
\grammarterm{class-head-name} defines an \defnadj{unnamed}{class}.
\begin{note}
An unnamed class thus can't
An unnamed class thus cannot
be \tcode{final}.
\end{note}
Otherwise, the \grammarterm{class-name} is an \grammarterm{identifier};
Expand Down Expand Up @@ -1026,7 +1026,7 @@
Programs shall not define implicitly-declared special member functions.

\pnum
Programs may explicitly refer to implicitly-declared special member functions.
Programs can explicitly refer to implicitly-declared special member functions.
\begin{example}
A program may explicitly call or form a pointer to member
to an implicitly-declared special member function.
Expand Down Expand Up @@ -1299,7 +1299,7 @@
\begin{note}
An implicitly-declared default constructor has an
exception specification\iref{except.spec}.
An explicitly-defaulted definition might have an
An explicitly-defaulted definition can have an
implicit exception specification, see~\ref{dcl.fct.def}.
\end{note}

Expand Down Expand Up @@ -1502,7 +1502,7 @@

\begin{note}
When the move constructor is not implicitly declared or explicitly supplied,
expressions that otherwise would have invoked the move constructor might instead invoke
expressions that otherwise would have invoked the move constructor can instead invoke
a copy constructor.
\end{note}

Expand Down Expand Up @@ -2111,7 +2111,7 @@
\begin{note}
A
\tcode{return}
statement\iref{stmt.return} in a destructor might not directly return to the
statement\iref{stmt.return} in a destructor can not directly return to the
caller; before transferring control to the caller, the destructors for the
members and bases are called.
\end{note}
Expand Down Expand Up @@ -4053,7 +4053,7 @@
\grammarterm{pure-specifier}\iref{class.mem} in the function declaration
in the class definition.
\begin{note}
Such a function might be inherited: see below.
Such a function can be inherited: see below.
\end{note}
A class is an \defnadj{abstract}{class}
if it has at least one pure virtual function.
Expand Down Expand Up @@ -4423,7 +4423,7 @@
\begin{note}
In a derived class, the lookup of a base class name will find the
injected-class-name instead of the name of the base class in the scope
in which it was declared. The injected-class-name might be less accessible
in which it was declared. The injected-class-name can be less accessible
than the name of the base class in the scope in which it was declared.
\end{note}

Expand Down Expand Up @@ -6033,7 +6033,7 @@
struct X { X(A*); };

struct E : C, D, X {
E() : D(this), // undefined behavior: upcast from \tcode{E*} to \tcode{A*} might use path \tcode{E*} $\rightarrow$ \tcode{D*} $\rightarrow$ \tcode{A*}
E() : D(this), // undefined behavior: upcast from \tcode{E*} to \tcode{A*} can use path \tcode{E*} $\rightarrow$ \tcode{D*} $\rightarrow$ \tcode{A*}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this one be better as "could"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ISO doesn't like "could" in notes and examples, I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually a bit more subtle than that: The verbal forms for provisions are strictly controlled. But if we're not expressing a provision, then there's in principle no restriction. What ISO/CS is worried about then is that one might mistakenly misunderstand something to be a provision (even though it's not meant to be one), and they then recommend rephrasing it so that such a misunderstanding can't happen.

We can belabor this separately for the WD, but for the IS I'd be OK to accept a somewhat crude replacement.

// but \tcode{D} is not constructed

// ``\tcode{D((C*)this)}\!'' would be defined: \tcode{E*} $\rightarrow$ \tcode{C*} is defined because \tcode{E()} has started,
Expand Down Expand Up @@ -6705,7 +6705,7 @@
the expression resulting from the interpretation of \tcode{x @ y}
using the selected rewritten candidate\iref{over.match.oper}
does not result in a usable candidate
(for example, that expression might be \tcode{(x <=> y) @ 0}), or
(for example, that expression can be \tcode{(x <=> y) @ 0}), or
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure I correctly understand what this \item is even saying, so I don't think the parenthetical example helps me.

Would this be clearer?

Suggested change
(for example, that expression can be \tcode{(x <=> y) @ 0}), or
(for example, when the resulting expression is \tcode{(x <=> y) @ 0}), or

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's not what we want to say. Your rewrite sounds like it's an example for "does not result in a usable candidate". The original phrasing just wants to give an example for the "expression resulting from the interpretation ... using the rewritten candidate". The rewritten candidate might be <=>.

Within the confines of what we can use, "can" is as good as we get here, I think.


\item
\tcode{x @ y} cannot be implicitly converted to \tcode{bool}.
Expand Down
28 changes: 14 additions & 14 deletions source/compatibility.tex
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@
Correct contradictory wording and
improve implementation flexibility for performance.
\effect
Valid \CppXX{} code using a barrier might have
Valid \CppXX{} code using a barrier can have
different semantics in this revision of \Cpp{}
if it depends on a completion function's side effects occurring exactly once,
on a specific thread running the phase completion step, or
Expand Down Expand Up @@ -1175,7 +1175,7 @@
\rationale
Improve efficiency and convenience of finding number of removed elements.
\effect
Code that depends on the return types might have different semantics in this revision of \Cpp{}.
Code that depends on the return types can have different semantics in this revision of \Cpp{}.
Translation units compiled against this version of \Cpp{} may be incompatible with
translation units compiled against \CppXVII{}, either failing to link or having undefined behavior.

Expand Down Expand Up @@ -1391,7 +1391,7 @@
\rationale
Prevents accidental uses of trigraphs in non-raw string literals and comments.
\effect
Valid \CppXIV{} code that uses trigraphs may not be valid or may have different
Valid \CppXIV{} code that uses trigraphs can be invalid or have different
semantics in this revision of \Cpp{}. Implementations may choose to
translate trigraphs as specified in \CppXIV{} if they appear outside of a raw
string literal, as part of the \impldef{mapping input source file characters
Expand Down Expand Up @@ -1521,8 +1521,8 @@
\rationale
Better interaction with other language features.
\effect
Valid \CppXIV{} code that uses inheriting constructors may not be valid
or may have different semantics. A \grammarterm{using-declaration}
Valid \CppXIV{} code that uses inheriting constructors can be invalid
or have different semantics. A \grammarterm{using-declaration}
that names a constructor now makes the corresponding base class constructors
visible to initializations of the derived class
rather than declaring additional derived class constructors.
Expand Down Expand Up @@ -1615,7 +1615,7 @@
New reserved namespaces.
\rationale
Reserve namespaces for future revisions of the standard library
that might otherwise be incompatible with existing programs.
that can otherwise be incompatible with existing programs.
\effect
The global namespaces \tcode{std}
followed by an arbitrary sequence of \grammarterm{digit}{s}\iref{lex.name}
Expand Down Expand Up @@ -1788,7 +1788,7 @@
void operator delete(void*, std::size_t) noexcept;
\end{codeblock}
In this revision of \Cpp{}, however, the declaration of \tcode{operator delete}
might match a predefined usual (non-placement)
can match a predefined usual (non-placement)
\tcode{operator delete}\iref{basic.stc.dynamic}. If so, the
program is ill-formed, as it was for class member allocation functions and
deallocation functions\iref{expr.new}.
Expand Down Expand Up @@ -2218,7 +2218,7 @@
\rationale
Avoid hard to diagnose or non-portable constructs.
\effect
Names of attribute identifiers may not be used as macro names. Valid \CppIII{}
It is not allowed to use names of attribute identifiers as macro names. Valid \CppIII{}
code that defines \tcode{override}, \tcode{final},
\tcode{carries_dependency}, or \tcode{noreturn} as macros is invalid in this
revision of \Cpp{}.
Expand Down Expand Up @@ -2297,7 +2297,7 @@
Lack of specification of complexity of \tcode{size()} resulted in
divergent implementations with inconsistent performance characteristics.
\effect
Some container implementations that conform to \CppIII{} may not conform to the
It is possible that some container implementations that conform to \CppIII{} do not conform to the
specified \tcode{size()} requirements in this revision of \Cpp{}. Adjusting
containers such as \tcode{std::list} to the stricter requirements may require
incompatible changes.
Expand Down Expand Up @@ -2404,7 +2404,7 @@
\effect
Valid \CppIII{} code that uses implementation-specific knowledge about the
binary representation of the required template specializations of
\tcode{std::complex} may not be compatible with this revision of \Cpp{}.
\tcode{std::complex} can be incompatible with this revision of \Cpp{}.

\rSec2[diff.cpp03.locale]{\ref{localization}: localization library}

Expand All @@ -2414,7 +2414,7 @@
\rationale
Required by new feature.
\effect
Valid \CppIII{} code may have different behavior in this revision of \Cpp{}.
Valid \CppIII{} code can have different behavior in this revision of \Cpp{}.

\rSec2[diff.cpp03.input.output]{\ref{input.output}: input/output library}

Expand Down Expand Up @@ -2567,7 +2567,7 @@
to ``array of \tcode{const wchar_t}''.
\rationale
This avoids calling an inappropriate overloaded function,
which might expect to be able to modify its argument.
such as one that expects to be able to modify its argument.
\effect
Change to semantics of well-defined feature.
\difficulty
Expand Down Expand Up @@ -3020,7 +3020,7 @@

\diffref{dcl.fct} [see \ref{expr.sizeof}]
\change
In \Cpp{}, types may not be defined in return or parameter types.
In \Cpp{}, defining types in return or parameter types is not allowed.
In C, these type definitions are allowed.

\begin{example}
Expand Down Expand Up @@ -3347,7 +3347,7 @@

\diffref{class.member.lookup}
\change
In \Cpp{}, a \grammarterm{typedef-name} may not be redeclared in a class definition after being used in that definition.
In \Cpp{}, it is not allowed to redeclare a \grammarterm{typedef-name} in a class definition after being used in that definition.

\begin{example}
\begin{codeblock}
Expand Down
2 changes: 1 addition & 1 deletion source/concepts.tex
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@
\begin{note}
This precludes calling unconstrained program-defined overloads of
\tcode{swap}. When the deleted overload is viable, program-defined overloads
need to be more specialized\iref{temp.func.order} to be selected.
are only selected if they are more specialized\iref{temp.func.order}.
\end{note}

\item
Expand Down
2 changes: 1 addition & 1 deletion source/containers.tex
Original file line number Diff line number Diff line change
Expand Up @@ -22314,7 +22314,7 @@
\pnum
\begin{note}
Concrete accessor policies can impose preconditions for their \tcode{access} function.
However, they might not.
However, it is possible that they do not.
For example, an accessor where
\tcode{p} is \tcode{span<A::element_type, dynamic_extent>} and
\tcode{access(p, i)} returns \tcode{p[i \% p.size()]}
Expand Down
Loading
Loading