Skip to content

Commit 84087b3

Browse files
burblebeezygoloid
authored andcommitted
[std] "must" fixes and suggested rewordings.
Partially addresses ISO/CS 017 (C++20 DIS).
1 parent 710838f commit 84087b3

14 files changed

+51
-64
lines changed

source/basic.tex

+4-4
Original file line numberDiff line numberDiff line change
@@ -2509,7 +2509,7 @@
25092509
\indextext{lookup!class member}%
25102510
In a class member access expression\iref{expr.ref}, if the \tcode{.}
25112511
or \tcode{->} token is immediately followed by an \grammarterm{identifier}
2512-
followed by a \tcode{<}, the identifier must be looked up to determine
2512+
followed by a \tcode{<}, the identifier is looked up to determine
25132513
whether the \tcode{<} is the beginning of a template argument
25142514
list\iref{temp.names} or a less-than operator. The identifier is first
25152515
looked up in the class of the object expression\iref{class.member.lookup}.
@@ -3615,9 +3615,9 @@
36153615
automatic storage duration, upon exit from the thread for an object with
36163616
thread storage duration, or upon exit from the program for an object
36173617
with static storage duration.}
3618-
the program must ensure that an object of the original type occupies
3618+
and another object of the original type does not occupy
36193619
that same storage location when the implicit destructor call takes
3620-
place; otherwise the behavior of the program is undefined. This is true
3620+
place, the behavior of the program is undefined. This is true
36213621
even if the block is exited with an exception.
36223622
\begin{example}
36233623
\begin{codeblock}
@@ -6157,7 +6157,7 @@
61576157
programs cannot observe most program transformations that do not change
61586158
single-threaded program semantics. In fact, most single-threaded program
61596159
transformations continue to be allowed, since any program that behaves
6160-
differently as a result must perform an undefined operation.
6160+
differently as a result has undefined behavior.
61616161
\end{note}
61626162

61636163
\pnum

source/classes.tex

+3-2
Original file line numberDiff line numberDiff line change
@@ -3259,8 +3259,9 @@
32593259

32603260
\pnum
32613261
\begin{note}
3262-
In general, one must use explicit destructor calls and placement
3263-
\grammarterm{new-expression} to change the active member of a union.
3262+
In cases where the above rule does not apply,
3263+
the active member of a union can only be changed by
3264+
the use of a placement \grammarterm{new-expression}.
32643265
\end{note}
32653266
\begin{example}
32663267
Consider an object \tcode{u} of a \tcode{union} type \tcode{U} having non-static data members

source/compatibility.tex

+1-3
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,7 @@
20392039

20402040
\diffref{expr.sizeof,expr.cast}
20412041
\change
2042-
Types must be defined in declarations, not in expressions.\\
2042+
In \Cpp{}, types can only be defined in declarations, not in expressions.\\
20432043
In C, a sizeof expression or cast expression may define a new type.
20442044
For example,
20452045
\begin{codeblock}
@@ -2637,8 +2637,6 @@
26372637
\Cpp{} is not identical to ISO C\@.
26382638
Mandating that \mname{STDC}
26392639
be defined would require that translators make an incorrect claim.
2640-
Each implementation must choose the behavior that will be most
2641-
useful to its marketplace.
26422640
\effect
26432641
Change to semantics of well-defined feature.
26442642
\difficulty

source/containers.tex

+3-2
Original file line numberDiff line numberDiff line change
@@ -4079,8 +4079,9 @@
40794079
\begin{note}
40804080
Modifying any list requires access to the element preceding the first element
40814081
of interest, but in a \tcode{forward_list} there is no constant-time way to access a
4082-
preceding element. For this reason, ranges that are modified, such as those supplied to
4083-
\tcode{erase} and \tcode{splice}, must be open at the beginning.
4082+
preceding element.
4083+
For this reason, \tcode{erase_after} and \tcode{splice_after}
4084+
take fully-open ranges, not semi-open ranges.
40844085
\end{note}
40854086

40864087
\begin{codeblock}

source/exceptions.tex

+2-1
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,8 @@
989989

990990
\pnum
991991
\indextext{\idxcode{terminate}}%
992-
In some situations exception handling must be abandoned
992+
% FIXME: What does it mean to abandon exception handling?
993+
In some situations exception handling is abandoned
993994
for less subtle error handling techniques.
994995
\begin{note}
995996
These situations are:

source/expressions.tex

+4-4
Original file line numberDiff line numberDiff line change
@@ -6437,12 +6437,12 @@
64376437
\begin{itemize}
64386438
\item If \tcode{E2} is an lvalue, the target type is
64396439
``lvalue reference to \tcode{T2}'', subject to the
6440-
constraint that in the conversion the reference must bind
6440+
constraint that in the conversion the reference binds
64416441
directly\iref{dcl.init.ref} to a glvalue.
64426442

64436443
\item If \tcode{E2} is an xvalue, the target type is
64446444
``rvalue reference to \tcode{T2}'',
6445-
subject to the constraint that the reference must bind directly.
6445+
subject to the constraint that the reference binds directly.
64466446

64476447
\item If \tcode{E2} is a prvalue or if neither of the conversion sequences above can be
64486448
formed and at least one of the operands has (possibly cv-qualified) class type:
@@ -6617,8 +6617,8 @@
66176617
no new exception object is created.
66186618
The exception is no longer considered to be caught.
66196619
\begin{example}
6620-
Code that must be executed because of an exception, but cannot
6621-
completely handle the exception itself, can be written like this:
6620+
An exception handler that cannot completely handle the exception itself
6621+
can be written like this:
66226622
\begin{codeblock}
66236623
try {
66246624
// ...

source/grammar.tex

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
In particular, the grammar described here accepts
1111
a superset of valid \Cpp{} constructs.
1212
Disambiguation rules~(\ref{stmt.ambig}, \ref{dcl.spec}, \ref{class.member.lookup})
13-
must be applied to distinguish expressions from declarations.
14-
Further, access control, ambiguity, and type rules must be used
13+
are applied to distinguish expressions from declarations.
14+
Further, access control, ambiguity, and type rules are used
1515
to weed out syntactically valid but meaningless constructs.
1616

1717
\rSec1[gram.key]{Keywords}

source/iostreams.tex

+3-6
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,8 @@
465465
\pnum
466466
Concurrent access to a synchronized\iref{ios.members.static} standard iostream object's formatted and unformatted input\iref{istream} and output\iref{ostream} functions or a standard C stream by multiple threads does not result in a data race\iref{intro.multithread}.
467467
\begin{note}
468-
Users must still synchronize concurrent use of these objects and streams by multiple threads if they wish to avoid interleaved characters.
468+
Unsynchronized concurrent use of these objects and streams by multiple threads
469+
can result in interleaved characters.
469470
\end{note}
470471

471472
\xrefc{7.21.2}
@@ -13550,9 +13551,6 @@
1355013551
\tcode{equivalent("foo", "bar")} will be \tcode{true} when both paths resolve to the same file.
1355113552
\end{example}
1355213553
\end{itemize}
13553-
Programmers wishing to determine if two paths are ``the same'' must decide if
13554-
``the same'' means ``the same representation'' or ``resolve to the same actual
13555-
file'', and choose the appropriate function accordingly.
1355613554
\end{note}
1355713555
\end{itemdescr}
1355813556

@@ -14251,8 +14249,7 @@
1425114249
\begin{note}
1425214250
Implementations of \tcode{directory_iterator}\iref{fs.class.directory.iterator}
1425314251
are prohibited from directly or indirectly calling the \tcode{refresh} function
14254-
since it must access the external file system,
14255-
and the objective of caching is to avoid unnecessary file system accesses.
14252+
as described in \ref{fs.class.directory.iterator.general}.
1425614253
\end{note}
1425714254
\end{itemdescr}
1425814255

source/iterators.tex

-5
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,6 @@
566566
The library never assumes that past-the-end values are dereferenceable.
567567
Iterators can also have singular values that are not associated with any
568568
sequence.
569-
\begin{example}
570-
After the declaration of an uninitialized pointer \tcode{x}
571-
(as with \tcode{int* x;}),
572-
\tcode{x} must always be assumed to have a singular value of a pointer.
573-
\end{example}
574569
Results of most expressions are undefined for singular values;
575570
the only exceptions are destroying an iterator that holds a singular value,
576571
the assignment of a non-singular value to

source/locales.tex

+2-2
Original file line numberDiff line numberDiff line change
@@ -2053,11 +2053,11 @@
20532053
\tcode{ok}.\footnote{Informally, this means that
20542054
\tcode{basic_filebuf}
20552055
assumes that the mappings from internal to external characters is
2056-
1 to N: a
2056+
1 to N: that a
20572057
\tcode{codecvt}
20582058
facet that is used by
20592059
\tcode{basic_filebuf}
2060-
must be able to translate characters one internal character at a time.
2060+
can translate characters one internal character at a time.
20612061
}
20622062
\begin{note}
20632063
As a result of operations on \tcode{state}, it can return \tcode{ok} or \tcode{partial} and set \tcode{from_next == from} and \tcode{to_next != to}.

source/overloading.tex

+2-2
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@
838838
a contrived object of type
839839
\tcode{T}
840840
becomes the implied object
841-
argument.\footnote{An implied object argument must be contrived to
841+
argument.\footnote{An implied object argument is contrived to
842842
correspond to the implicit object
843843
parameter attributed to member functions during overload resolution.
844844
It is not
@@ -3352,7 +3352,7 @@
33523352
and
33533353
\tcode{g()}
33543354
are both overloaded functions, the
3355-
cross product of possibilities must be considered
3355+
Cartesian product of possibilities is considered
33563356
to resolve
33573357
\tcode{f(\&g)},
33583358
or the equivalent expression

source/statements.tex

+9-4
Original file line numberDiff line numberDiff line change
@@ -1005,10 +1005,15 @@
10051005
declaration.
10061006
If control enters the declaration concurrently while the variable is
10071007
being initialized, the concurrent execution shall wait for completion
1008-
of the initialization.\footnote{The implementation must not introduce
1009-
any deadlock around execution of the initializer. Deadlocks might
1010-
still be caused by the program logic; the implementation need only
1011-
avoid deadlocks due to its own synchronization operations.} If control
1008+
of the initialization.
1009+
\begin{note}
1010+
A conforming implementation cannot introduce
1011+
any deadlock around execution of the initializer.
1012+
Deadlocks might still be caused by the program logic;
1013+
the implementation need only avoid deadlocks
1014+
due to its own synchronization operations.
1015+
\end{note}
1016+
If control
10121017
re-enters the declaration recursively while
10131018
the variable is being initialized, the behavior is undefined.
10141019
\begin{example}

source/templates.tex

+10-22
Original file line numberDiff line numberDiff line change
@@ -694,31 +694,18 @@
694694
id-expression
695695
\end{bnf}
696696

697-
\begin{note}
698-
The name lookup rules\iref{basic.lookup} are used to associate the use of
699-
a name with a template declaration;
700-
that is, to identify a name as a
701-
\grammarterm{template-name}.
702-
\end{note}
703-
704697
\pnum
705-
For a
706-
\grammarterm{template-name}
707-
to be explicitly qualified by the template arguments,
708-
the name must be considered to refer to a template.
698+
An \grammarterm{identifier} is a \grammarterm{template-name}
699+
if it is associated by name lookup with
700+
a template or an overload set that contains a function template, or
701+
the \grammarterm{identifier} is followed by \tcode{<},
702+
the \grammarterm{template-id} would form an \grammarterm{unqualified-id}, and
703+
name lookup either finds one or more functions or finds nothing.
709704
\begin{note}
710705
Whether a name actually refers to a template
711706
cannot be known in some cases
712707
until after argument dependent lookup is done\iref{basic.lookup.argdep}.
713708
\end{note}
714-
A name is considered to refer to a template if
715-
name lookup finds
716-
a \grammarterm{template-name}
717-
or an overload set that contains a function template.
718-
A name is also considered to refer to a template if
719-
it is an \grammarterm{unqualified-id}
720-
followed by a \tcode{<}
721-
and name lookup either finds one or more functions or finds nothing.
722709

723710
\pnum
724711
\indextext{\idxcode{<}!template and}%
@@ -4642,7 +4629,7 @@
46424629
is the standard output stream declared in
46434630
\tcode{iostream}.
46444631
However, not every declaration can be found this way; the resolution of
4645-
some names must be postponed
4632+
some names is postponed
46464633
until the actual
46474634
\grammarterm{template-argument}{s}
46484635
are known.
@@ -7132,12 +7119,13 @@
71327119
otherwise, it is a declaration.
71337120
\begin{note}
71347121
The definition of a static data member of a template
7135-
that requires default-initialization must use a \grammarterm{braced-init-list}:
7122+
for which default-initialization is desired
7123+
can use functional cast notation\iref{expr.type.conv}:
71367124

71377125
\begin{codeblock}
71387126
template<> X Q<int>::x; // declaration
71397127
template<> X Q<int>::x (); // error: declares a function
7140-
template<> X Q<int>::x { }; // definition
7128+
template<> X Q<int>::x = X(); // definition
71417129
\end{codeblock}
71427130
\end{note}
71437131

source/threads.tex

+6-5
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@
9393
\pnum
9494
The functions whose names end in \tcode{_for} take an argument that
9595
specifies a duration. These functions produce relative timeouts. Implementations
96-
should use a steady clock to measure time for these functions.\footnote{All
97-
implementations for which standard time units are meaningful must necessarily
96+
should use a steady clock to measure time for these functions.%
97+
\footnote{Implementations for which standard time units are meaningful will typically
9898
have a steady clock within their hardware implementation.} Given a duration
9999
argument $D_t$, the real-time duration of the timeout is $D_t + D_i + D_m$.
100100

@@ -1271,8 +1271,9 @@
12711271
\begin{note}
12721272
Either implicitly detaching or joining a \tcode{joinable()} thread in its
12731273
destructor could result in difficult to debug correctness (for detach) or performance
1274-
(for join) bugs encountered only when an exception is thrown. Thus the programmer must
1275-
ensure that the destructor is never executed while the thread is still joinable.
1274+
(for join) bugs encountered only when an exception is thrown.
1275+
These bugs can be avoided by ensuring that
1276+
the destructor is never executed while the thread is still joinable.
12761277
\end{note}
12771278
\end{itemdescr}
12781279

@@ -4029,7 +4030,7 @@
40294030
not result in deadlock, but is otherwise unspecified.
40304031
\begin{note}
40314032
A deadlock avoidance
4032-
algorithm such as try-and-back-off must be used, but the specific algorithm is not
4033+
algorithm such as try-and-back-off can be used, but the specific algorithm is not
40334034
specified to avoid over-constraining implementations.
40344035
\end{note}
40354036
If a call to

0 commit comments

Comments
 (0)