diff --git a/source/algorithms.tex b/source/algorithms.tex index 3e6239f8be..3701058765 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -203,10 +203,11 @@ \pnum \begin{note} Unless otherwise specified, algorithms that take function objects as arguments -are permitted to copy those function objects freely. -Programmers for whom object identity is important should consider -using a wrapper class that points to a noncopied implementation object -such as \tcode{reference_wrapper}\iref{refwrap}, or some equivalent solution. +can copy those function objects freely. +If object identity is important, +a wrapper class that points to a noncopied implementation object +such as \tcode{reference_wrapper}\iref{refwrap}, or some equivalent solution, +can be used. \end{note} \pnum @@ -261,8 +262,8 @@ The number and order of deducible template parameters for algorithm declarations are unspecified, except where explicitly stated otherwise. \begin{note} -Consequently, the algorithms may not -be called with explicitly-specified template argument lists. +Consequently, an implementation can reject calls +that specify an explicit template argument list. \end{note} \rSec1[algorithms.parallel]{Parallel algorithms} @@ -353,7 +354,7 @@ \tcode{BinaryOperation1}, \tcode{BinaryOperation2}, and the operators used by the analogous overloads to these parallel algorithms -that could be formed by the invocation +that are formed by an invocation with the specified default predicate or operation (where applicable) shall not directly or indirectly modify objects via their arguments, nor shall they rely on the identity of the provided objects. @@ -388,13 +389,13 @@ where \tcode{is_trivially_copy_constructible_v} and \tcode{is_trivially_destructible_v} are \tcode{true}. \begin{note} -This implies that user-supplied function objects should not rely on +This implies that user-supplied function objects cannot rely on object identity of arguments for such input sequences. -Users for whom the object identity of the arguments to these function objects -is important should consider using a wrapping iterator +If object identity of the arguments to these function objects +is important, a wrapping iterator that returns a non-copied implementation object -such as \tcode{reference_wrapper}\iref{refwrap} -or some equivalent solution. +such as \tcode{reference_wrapper}\iref{refwrap}, +or some equivalent solution, can be used. \end{note} \pnum @@ -413,7 +414,7 @@ unsequenced with respect to one another in the calling thread of execution. \begin{note} This means that multiple function object invocations -may be interleaved on a single thread of execution, +can be interleaved on a single thread of execution, which overrides the usual guarantee from \ref{intro.execution} that function executions do not overlap with one another. \end{note} @@ -499,7 +500,7 @@ or threads of execution implicitly created by the library; the latter will provide weakly parallel forward progress guarantees. \begin{note} -This means that multiple function object invocations may be interleaved +This means that multiple function object invocations can be interleaved on a single thread of execution, which overrides the usual guarantee from \ref{intro.execution} that function executions do not overlap with one another. @@ -3152,7 +3153,7 @@ starting from \tcode{first} and proceeding to \tcode{last - 1}. \begin{note} If the type of \tcode{first} meets the requirements of a mutable iterator, -\tcode{f} may apply non-constant functions through the dereferenced iterator. +\tcode{f} can apply non-constant functions through the dereferenced iterator. \end{note} \pnum @@ -3187,7 +3188,7 @@ every iterator in the range \range{first}{last}. \begin{note} If the type of \tcode{first} meets the requirements of a mutable iterator, -\tcode{f} may apply non-constant functions through the dereferenced iterator. +\tcode{f} can apply non-constant functions through the dereferenced iterator. \end{note} \pnum @@ -3204,7 +3205,7 @@ \pnum \begin{note} Does not return a copy of its \tcode{Function} parameter, -since parallelization may not permit efficient state accumulation. +since parallelization often does not permit efficient state accumulation. \end{note} \end{itemdescr} @@ -3228,7 +3229,7 @@ starting from \tcode{first} and proceeding to \tcode{last - 1}. \begin{note} If the result of \tcode{invoke(proj, *i)} is a mutable reference, -\tcode{f} may apply non-constant functions. +\tcode{f} can apply non-constant functions. \end{note} \pnum @@ -3280,7 +3281,7 @@ every iterator in the range \range{first}{first + n} in order. \begin{note} If the type of \tcode{first} meets the requirements of a mutable iterator, -\tcode{f} may apply non-constant functions through the dereferenced iterator. +\tcode{f} can apply non-constant functions through the dereferenced iterator. \end{note} \pnum @@ -3319,7 +3320,7 @@ every iterator in the range \range{first}{first + n}. \begin{note} If the type of \tcode{first} meets the requirements of a mutable iterator, -\tcode{f} may apply non-constant functions through the dereferenced iterator. +\tcode{f} can apply non-constant functions through the dereferenced iterator. \end{note} \pnum @@ -3354,7 +3355,7 @@ \range{first}{first + n} in order. \begin{note} If the result of \tcode{invoke(proj, *i)} is a mutable reference, -\tcode{f} may apply non-constant functions. +\tcode{f} can apply non-constant functions. \end{note} \pnum @@ -4398,7 +4399,7 @@ do not overlap. \begin{note} For the overload with an \tcode{ExecutionPolicy}, -there may be a performance cost +there might be a performance cost if \tcode{iterator_traits::value_type} is not \oldconcept{\-Move\-Constructible} (\tref{cpp17.moveconstructible}). \end{note} @@ -4461,7 +4462,7 @@ Copies elements in the range \range{first}{last} into the range \range{result - $N$}{result} starting from \tcode{last - 1} and proceeding to \tcode{first}.% -\footnote{\tcode{copy_backward} should be used instead of copy +\footnote{\tcode{copy_backward} can be used instead of copy when \tcode{last} is in the range \range{result - $N$}{result}.} For each positive integer $n \le N$, performs \tcode{*(result - $n$) = *(last - $n$)}. @@ -4612,7 +4613,7 @@ Moves elements in the range \range{first}{last} into the range \range{result - $N$}{result} starting from \tcode{last - 1} and proceeding to \tcode{first}.% -\footnote{\tcode{move_backward} should be used instead of move +\footnote{\tcode{move_backward} can be used instead of move when \tcode{last} is in the range \range{result - $N$}{result}.} For each positive integer $n \le N$, performs \tcode{*(result - $n$) = $E$}. @@ -5296,7 +5297,7 @@ do not overlap. \begin{note} For the overloads with an \tcode{ExecutionPolicy}, -there may be a performance cost +there might be a performance cost if \tcode{iterator_traits::value_type} does not meet the \oldconcept{\-Move\-Constructible} (\tref{cpp17.moveconstructible}) requirements. \end{note} @@ -5483,7 +5484,7 @@ \oldconcept{CopyAssignable} requirements. \begin{note} For the overloads with an \tcode{ExecutionPolicy}, - there may be a performance cost + there might be a performance cost if the value type of \tcode{ForwardIterator1} does not meet both the \oldconcept{CopyConstructible} and \oldconcept{CopyAssignable} requirements. \end{note} @@ -7019,7 +7020,7 @@ \begin{note} For the overload with an \tcode{ExecutionPolicy}, -there may be a performance cost if \tcode{first}'s value type +there might be a performance cost if \tcode{first}'s value type does not meet the \oldconcept{CopyConstructible} requirements. \end{note} @@ -9537,7 +9538,7 @@ that \tcode{exclusive_scan} excludes the $i^\text{th}$ input element from the $i^\text{th}$ sum. If \tcode{binary_op} is not mathematically associative, -the behavior of \tcode{exclusive_scan} may be nondeterministic. +the behavior of \tcode{exclusive_scan} might be nondeterministic. \end{note} \end{itemdescr} @@ -9664,7 +9665,7 @@ that \tcode{inclusive_scan} includes the $i^\text{th}$ input element in the $i^\text{th}$ sum. If \tcode{binary_op} is not mathematically associative, -the behavior of \tcode{inclusive_scan} may be nondeterministic. +the behavior of \tcode{inclusive_scan} might be nondeterministic. \end{note} \end{itemdescr} @@ -9739,7 +9740,7 @@ \tcode{transform_inclusive_scan} is that \tcode{trans\-form\-_\-exclusive_scan} excludes the $i^\text{th}$ input element from the $i^\text{th}$ sum. If \tcode{binary_op} is not mathematically associative, -the behavior of \tcode{transform_exclusive_scan} may be nondeterministic. +the behavior of \tcode{transform_exclusive_scan} might be nondeterministic. \tcode{transform_exclusive_scan} does not apply \tcode{unary_op} to \tcode{init}. \end{note} @@ -9843,7 +9844,7 @@ \tcode{transform_inclusive_scan} is that \tcode{trans\-form\-_\-inclusive_scan} includes the $i^\text{th}$ input element in the $i^\text{th}$ sum. If \tcode{binary_op} is not mathematically associative, -the behavior of \tcode{transform_inclusive_scan} may be nondeterministic. +the behavior of \tcode{transform_inclusive_scan} might be nondeterministic. \tcode{transform_inclusive_scan} does not apply \tcode{unary_op} to \tcode{init}. \end{note} diff --git a/source/atomics.tex b/source/atomics.tex index f8ef717570..e7bf431e4b 100644 --- a/source/atomics.tex +++ b/source/atomics.tex @@ -528,7 +528,7 @@ r2 = x.load(memory_order::relaxed); y.store(r2, memory_order::relaxed); \end{codeblock} -should not produce \tcode{r1 == r2 == 42}, since the store of 42 to \tcode{y} is only +this recommendation discourages producing \tcode{r1 == r2 == 42}, since the store of 42 to \tcode{y} is only possible if the store to \tcode{x} stores \tcode{42}, which circularly depends on the store to \tcode{y} storing \tcode{42}. Note that without this restriction, such an execution is possible. @@ -636,11 +636,15 @@ block\iref{intro.progress}. \pnum -\begin{note} -Operations that are lock-free should also be address-free. That is, +\recommended +Operations that are lock-free should also be address-free% +\footnote{ +That is, atomic operations on the same memory location via two different addresses will -communicate atomically. The implementation should not depend on any -per-process state. This restriction enables communication by memory that is +communicate atomically.}. +The implementation of these operations should not depend on any per-process state. +\begin{note} +This restriction enables communication by memory that is mapped into a process more than once and by memory that is shared between two processes. \end{note} @@ -1602,7 +1606,7 @@ is \tcode{false}. \begin{note} Type arguments that are -not also statically initializable may be difficult to use. +not also statically initializable might be difficult to use. \end{note} \pnum @@ -3442,10 +3446,7 @@ \pnum Operations on an object of type \tcode{atomic_flag} shall be lock-free. -\begin{note} -Hence -the operations should also be address-free. -\end{note} +The operations should also be address-free. \pnum The \tcode{atomic_flag} type is a standard-layout struct. diff --git a/source/basic.tex b/source/basic.tex index 223bcf1ac4..b032171f60 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -692,10 +692,10 @@ The entity is still declared in multiple translation units, and \ref{basic.link} still applies to these declarations. In particular, \grammarterm{lambda-expression}{s}\iref{expr.prim.lambda} -appearing in the type of \tcode{D} may result +appearing in the type of \tcode{D} might result in the different declarations having distinct types, and \grammarterm{lambda-expression}{s} appearing in a default argument of \tcode{D} -may still denote different types in different translation units. +might still denote different types in different translation units. \end{note} \pnum @@ -822,9 +822,9 @@ a name is introduced, which is not necessarily the same as the region in which the declaration occurs. In particular, \grammarterm{elaborated-type-specifier}{s}\iref{dcl.type.elab} and -friend declarations\iref{class.friend} may introduce a (possibly not +friend declarations\iref{class.friend} can introduce a (possibly not visible) name into an enclosing namespace; these restrictions apply to -that region. Local extern declarations\iref{basic.link} may introduce +that region. Local extern declarations\iref{basic.link} can introduce a name into the declarative region where the declaration appears and also introduce a (possibly not visible) name into an enclosing namespace; these restrictions apply to both regions. @@ -1531,7 +1531,7 @@ A name used in the definition of a class \tcode{X}% \footnote{This refers to unqualified names following the class name; -such a name may be used in a \grammarterm{base-specifier} or +such a name might be used in a \grammarterm{base-specifier} or in the \grammarterm{member-specification} of the class definition.} outside of a complete-class context\iref{class.mem} of \tcode{X} shall be declared in one of the following ways: @@ -2635,7 +2635,7 @@ \pnum \indextext{translation unit}% -A name is said to have \defn{linkage} when it might denote the same +A name is said to have \defn{linkage} when it can denote the same object, reference, function, type, template, namespace or value as a name introduced by a declaration in another scope: \begin{itemize} @@ -2834,7 +2834,7 @@ \grammarterm{using-directive}{s} do not declare entities. Enumerators do not have linkage, -but may serve as the name of an enumeration with linkage\iref{dcl.enum}. +but might serve as the name of an enumeration with linkage\iref{dcl.enum}. \end{note} \pnum @@ -4211,7 +4211,7 @@ less than or equal to the greatest alignment supported by the implementation in all contexts, which is equal to \tcode{alignof(std::max_align_t)}\iref{support.types}. -The alignment required for a type might be different when it is used as the type +The alignment required for a type may be different when it is used as the type of a complete object and when it is used as the type of a subobject. \begin{example} \begin{codeblock} @@ -4538,7 +4538,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 may introduce a dangling reference. +This might introduce a dangling reference. \end{note} \begin{example} \begin{codeblock} @@ -4750,14 +4750,14 @@ incomplete type. \pnum -A class type (such as ``\tcode{class X}'') might be incomplete at one +A class type (such as ``\tcode{class X}'') can be incomplete at one point in a translation unit and complete later on; the type ``\tcode{class X}'' is the same type at both points. The declared type -of an array object might be an array of incomplete class type and +of an array object can be an array of incomplete class type and therefore incomplete; if the class type is completed later on in the translation unit, the array type becomes complete; the array type at those two points is the same type. The declared type of an array object -might be an array of unknown bound and therefore be incomplete at one +can be an array of unknown bound and therefore be incomplete at one point in a translation unit and complete later on; the array types at those two points (``array of unknown bound of \tcode{T}'' and ``array of \tcode{N} \tcode{T}'') are different types. The type of a pointer to array of @@ -5746,7 +5746,7 @@ \end{example} The sequencing constraints on the execution of the called function (as described above) are features of the function calls as evaluated, -whatever the syntax of the expression that calls the function might be.% +regardless of the syntax of the expression that calls the function.% \indextext{value computation|)}% \indextext{behavior!on receipt of signal}% @@ -5809,7 +5809,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 may instead be undefined behavior. Much of this +In some cases, there might 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. @@ -5852,7 +5852,7 @@ There is a separate order for each atomic object. There is no requirement that these can be combined into a single total order for all objects. In general this will be impossible since different -threads may observe modifications to different objects in inconsistent orders. +threads might observe modifications to different objects in inconsistent orders. \end{note} \pnum @@ -6181,14 +6181,14 @@ 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 -may alias is also generally precluded, since this may violate the coherence +might 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 may not preserve the semantics of the \Cpp{} program as +shared memory location might 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 @@ -6224,7 +6224,7 @@ a lock-free execution in that thread shall complete. \begin{note} Concurrently executing threads - may prevent progress of a lock-free execution. + might prevent progress of a lock-free execution. For example, this situation can occur with load-locked store-conditional implementations. @@ -6238,15 +6238,15 @@ to provide absolute guarantees to this effect, since repeated and particularly inopportune interference from other threads - may prevent forward progress, + could prevent forward progress, e.g., by repeatedly stealing a cache line for unrelated purposes between load-locked and store-conditional instructions. - Implementations should ensure - that such effects cannot indefinitely delay progress + For implementations that follow this recommendation and + ensure that such effects cannot indefinitely delay progress under expected operating conditions, - and that such anomalies + such anomalies can therefore safely be ignored by programmers. Outside this document, this property is sometimes termed lock-free. @@ -6306,9 +6306,7 @@ \tcode{std::thread}\iref{thread.thread.class} or \tcode{std::jthread}\iref{thread.jthread.class} provide concurrent forward progress guarantees. -\begin{note} General-purpose implementations should provide these guarantees. -\end{note} \pnum \indextext{forward progress guarantees!parallel}% @@ -6346,7 +6344,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 may only +For example, some kinds of synchronization between threads of execution might 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} @@ -6377,7 +6375,7 @@ stronger forward progress guarantee for a certain amount of time, due to a second thread of execution $A$ being blocked on it with forward progress guarantee delegation. In turn, if $B$ then blocks with -forward progress guarantee delegation on $C$, this may also temporarily +forward progress guarantee delegation on $C$, this could also temporarily provide a stronger forward progress guarantee to $C$. \end{note} @@ -6414,9 +6412,7 @@ A program shall contain a global function called \tcode{main} attached to the global module. Executing a program starts a main thread of execution~(\ref{intro.multithread}, \ref{thread.threads}) -in which the \tcode{main} function is invoked, -and in which variables of static storage duration -might be initialized\iref{basic.start.static} and destroyed\iref{basic.start.term}. +in which the \tcode{main} function is invoked. \indextext{implementation!freestanding}% It is \impldef{defining \tcode{main} in freestanding environment} whether a program in a freestanding environment is required to define a \tcode{main} @@ -6567,10 +6563,10 @@ inline double fd() { return 1.0; } extern double d1; double d2 = d1; // unspecified: - // may be statically initialized to \tcode{0.0} or + // either statically initialized to \tcode{0.0} or // dynamically initialized to \tcode{0.0} if \tcode{d1} is // dynamically initialized, or \tcode{1.0} otherwise -double d1 = fd(); // may be initialized statically or dynamically to \tcode{1.0} +double d1 = fd(); // either initialized statically or dynamically to \tcode{1.0} \end{codeblock} \end{note} @@ -6667,9 +6663,10 @@ even if it is not itself odr-used~(\ref{basic.def.odr}, \ref{basic.stc.static}).} It is \impldef{threads and program points at which deferred dynamic initialization is performed} in which threads and at which points in the program such deferred dynamic initialization occurs. -\begin{note} -Such points should be chosen in a way that allows the programmer to avoid deadlocks. -\end{note} + +\recommended +An implementation should choose such points in a way +that allows the programmer to avoid deadlocks. \begin{example} \begin{codeblock} // - File 1 - diff --git a/source/classes.tex b/source/classes.tex index ff1117ac4c..4d90b15310 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -196,7 +196,7 @@ address\iref{expr.eq}.} \begin{note} $M(\mathtt{X})$ is the set of the types of all non-base-class subobjects -that may be at a zero offset in \tcode{X}. +that can be at a zero offset in \tcode{X}. \end{note} \begin{itemize} @@ -869,7 +869,7 @@ member function shall not be redeclared. \begin{note} There can be at most one definition of a non-inline member function in -a program. There may be more than one +a program. There can be more than one inline member function definition in a program. See~\ref{basic.def.odr} and~\ref{dcl.inline}. \end{note} @@ -1529,7 +1529,7 @@ \pnum \begin{note} -All forms of copy/move constructor may be declared for a class. +All forms of copy/move constructor can be declared for a class. \begin{example} \begin{codeblock} struct X { @@ -1650,7 +1650,7 @@ \begin{note} When the move constructor is not implicitly declared or explicitly supplied, -expressions that otherwise would have invoked the move constructor may instead invoke +expressions that otherwise would have invoked the move constructor might instead invoke a copy constructor. \end{note} @@ -1815,7 +1815,7 @@ see~\ref{over.ass}. \end{note} \begin{note} -More than one form of copy assignment operator may be declared for a class. +More than one form of copy assignment operator can be declared for a class. \end{note} \begin{note} If a class @@ -1889,8 +1889,7 @@ \end{note} {} \begin{note} -More -than one form of move assignment operator may be declared for a class. +More than one form of move assignment operator can be declared for a class. \end{note} \pnum @@ -2302,11 +2301,13 @@ derived classes. Bases and members are destroyed in the reverse order of the completion of their constructor (see~\ref{class.base.init}). +\begin{note} A \tcode{return} statement\iref{stmt.return} in a destructor might not directly return to the caller; before transferring control to the caller, the destructors for the members and bases are called. +\end{note} \indextext{order of execution!destructor and array}% Destructors for elements of an array are called in reverse order of their construction (see~\ref{class.init}). @@ -2568,7 +2569,7 @@ constructors, but does so only where the direct-initialization syntax\iref{dcl.init} or where casts~(\ref{expr.static.cast}, \ref{expr.cast}) are explicitly used; see also~\ref{over.match.copy}. -A default constructor may be an explicit constructor; such a constructor +A default constructor can be an explicit constructor; such a constructor will be used to perform default-initialization or value-initialization\iref{dcl.init}. \begin{example} @@ -2598,7 +2599,7 @@ a converting constructor. \begin{note} An implicitly-declared copy/move constructor is not an explicit constructor; -it may be called for implicit type conversions. +it can be called for implicit type conversions. \end{note} \rSec3[class.conv.fct]{Conversion functions}% @@ -3600,9 +3601,9 @@ from the layout of a most derived object of the same type. A base class subobject might have a polymorphic behavior\iref{class.cdtor} different from the polymorphic behavior of a most derived object of the -same type. A base class subobject may be of zero size; +same type. A base class subobject can be of zero size; however, two subobjects that have the same class type and that belong to -the same most derived object must not be allocated at the same +the same most derived object cannot be allocated at the same address\iref{intro.object}. \end{note} @@ -4215,7 +4216,7 @@ \pnum \begin{note} An abstract class can be derived from a class that is not abstract, and -a pure virtual function may override a virtual function which is not +a pure virtual function can override a virtual function which is not pure. \end{note} @@ -5155,7 +5156,7 @@ \end{ncsimplebnf} \begin{note} -A friend declaration may be the +A friend declaration can be the \grammarterm{declaration} in a \grammarterm{template-declaration} (\ref{temp.pre}, \ref{temp.friend}). \end{note} @@ -5663,7 +5664,7 @@ refers to the class member. A \grammarterm{mem-initializer-id} -for the hidden base class may be specified using a qualified name. +for the hidden base class can be specified using a qualified name. \end{note} Unless the \grammarterm{mem-initializer-id} @@ -5822,7 +5823,7 @@ \begin{note} An abstract class\iref{class.abstract} is never a most derived class, thus its constructors never initialize virtual base classes, therefore the -corresponding \grammarterm{mem-initializer}{s} may be omitted. +corresponding \grammarterm{mem-initializer}{s} can be omitted. \end{note} An attempt to initialize more than one non-static data member of a union renders the program ill-formed. @@ -6594,7 +6595,8 @@ a variable of automatic storage duration that is either a non-volatile object or an rvalue reference to a non-volatile object type. -In the following copy-initialization contexts, a move operation might be used instead of a copy operation: +In the following copy-initialization contexts, +a move operation is first considered before attempting a copy operation: \begin{itemize} \item If the \grammarterm{expression} in a \tcode{return}\iref{stmt.return} or \tcode{co_return}\iref{stmt.return.coroutine} statement @@ -6619,7 +6621,7 @@ overload resolution is performed again, considering the expression or operand as an lvalue. \begin{note} -This two-stage overload resolution must be performed regardless +This two-stage overload resolution is performed regardless of whether copy elision will occur. It determines the constructor or the \tcode{return_value} overload to be called if elision is not performed, and the selected constructor @@ -6797,7 +6799,7 @@ has no \grammarterm{noexcept-specifier}, the implicitly-declared \tcode{==} operator function has an implicit exception specification\iref{except.spec} that -may differ from the implicit exception specification of +can differ from the implicit exception specification of the three-way comparison operator function. \end{note} \begin{example} @@ -6924,7 +6926,7 @@ \end{itemize} \begin{note} -A synthesized three-way comparison may be ill-formed +A synthesized three-way comparison is ill-formed if overload resolution finds usable candidates that do not otherwise meet the requirements implied by the defined expression. \end{note} @@ -7203,8 +7205,10 @@ \pnum Access to the deallocation function is checked statically. +\begin{note} Hence, even though a different one might actually be executed, the statically visible deallocation function is required to be accessible. +\end{note} \begin{example} For the call on line ``// 1'' above, if diff --git a/source/concepts.tex b/source/concepts.tex index d68d1fa131..9d6d69880d 100644 --- a/source/concepts.tex +++ b/source/concepts.tex @@ -395,7 +395,7 @@ \term{common reference type}, \tcode{C}. \begin{note} \tcode{C} could be the same as \tcode{T}, or \tcode{U}, or it could be a -different type. \tcode{C} may be a reference type. +different type. \tcode{C} can be a reference type. \end{note} \begin{itemdecl} diff --git a/source/containers.tex b/source/containers.tex index 2bad8c8618..00d5ab6ffd 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -457,7 +457,7 @@ pointers, or iterators referring to the elements of the containers being swapped. \begin{note} -The \tcode{end()} iterator does not refer to any element, so it may be invalidated. +The \tcode{end()} iterator does not refer to any element, so it can be invalidated. \end{note} \end{itemize} @@ -604,7 +604,7 @@ with \tcode{m == get_allocator()}. The default \tcode{construct} in \tcode{allocator} will call \tcode{::new((void*)p) T(args)}, -but specialized allocators may choose a different definition. +but specialized allocators can choose a different definition. \end{note} \pnum @@ -753,10 +753,10 @@ \begin{note} For a \tcode{vector x} with a size greater than one, \tcode{x[1] = 5} and \tcode{*x.begin() = 10} can be executed concurrently without a data race, but -\tcode{x[0] = 5} and \tcode{*x.begin() = 10} executed concurrently may result in a data +\tcode{x[0] = 5} and \tcode{*x.begin() = 10} executed concurrently can result in a data race. As an exception to the general rule, for a \tcode{vector y}, \tcode{y[0] = true} -may race with \tcode{y[1] = true}. +can race with \tcode{y[1] = true}. \end{note} \rSec2[sequence.reqmts]{Sequence containers} @@ -768,24 +768,21 @@ \tcode{array} is provided as a sequence container which provides limited sequence operations because it has a fixed number of elements. The library also provides container adaptors that make it easy to construct abstract data types, such as \tcode{stack}s or \tcode{queue}s, out of -the basic sequence container kinds (or out of other kinds of sequence containers that the user -might define). +the basic sequence container kinds (or out of other kinds of sequence containers that the user defines). \pnum \begin{note} The sequence containers -offer the programmer different complexity trade-offs and should be used -accordingly. +offer the programmer different complexity trade-offs. \tcode{vector} -is the type of sequence container that should be used by default. +is appropriate in most circumstances. \tcode{array} -should be used when the container has a fixed size known during translation. +has a fixed size known during translation. \tcode{list} or \tcode{forward_list} -should be used when there are frequent insertions and deletions from the +support frequent insertions and deletions from the middle of the sequence. \tcode{deque} -is the data structure of choice -when most insertions and deletions take place at the beginning or at the +supports efficient insertions and deletions taking place at the beginning or at the end of the sequence. When choosing a container, remember \tcode{vector} is best; leave a comment to explain if you choose from the rest! @@ -879,7 +876,7 @@ \effects Inserts an object of type \tcode{T} constructed with \tcode{std::forward<\brk{}Args\brk{}>(\brk{}args)...} before \tcode{p}. \begin{note} -\tcode{args} may directly or indirectly refer to +\tcode{args} can directly or indirectly refer to a value in \tcode{a}. \end{note} \\ \rowsep @@ -2873,7 +2870,7 @@ \indexunordmem{max_bucket_count}% \tcode{b.max_bucket_count()} & \tcode{size_type} -& \returns An upper bound on the number of buckets that \tcode{b} might +& \returns An upper bound on the number of buckets that \tcode{b} can ever contain.% & Constant \\ \rowsep @@ -3493,7 +3490,7 @@ \pnum \begin{note} Unlike the \tcode{swap} function for other containers, \tcode{array::swap} -takes linear time, may exit via an exception, and does not cause iterators to +takes linear time, can exit via an exception, and does not cause iterators to become associated with the other container. \end{note} \end{itemdescr} @@ -5852,7 +5849,7 @@ \throws \tcode{length_error} if \tcode{n > max_size()}.\footnote{\tcode{reserve()} uses \tcode{Allocator::allocate()} which -may throw an appropriate exception.} +can throw an appropriate exception.} \pnum \remarks diff --git a/source/declarations.tex b/source/declarations.tex index d6948ecea1..f97a59ffc6 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -110,7 +110,7 @@ of the \grammarterm{init-declarator-list}. \begin{note} In the declaration for an entity, attributes appertaining to that -entity may appear at the start of the declaration and after the +entity can appear at the start of the declaration and after the \grammarterm{declarator-id} for that declaration. \end{note} \begin{example} @@ -1086,7 +1086,7 @@ from the end of every definition domain in which it is declared; no diagnostic is required. \begin{note} -A call to an inline function or a use of an inline variable may be encountered +A call to an inline function or a use of an inline variable can be encountered before its definition becomes reachable in a translation unit. \end{note} @@ -3141,7 +3141,7 @@ When several ``array of'' specifications are adjacent, a multidimensional array type is created; only the first of the constant expressions -that specify the bounds of the arrays may be omitted. +that specify the bounds of the arrays can be omitted. \begin{example} \begin{codeblock} int x3d[3][5][7]; @@ -3940,7 +3940,7 @@ \begin{note} The keyword \tcode{this} -may not appear in a default argument of a member function; +cannot appear in a default argument of a member function; see~\ref{expr.prim.this}. \begin{example} \begin{codeblock} @@ -4365,7 +4365,7 @@ is called \defn{copy-initialization}. \begin{note} -Copy-initialization may invoke a move\iref{class.copy.ctor}. +Copy-initialization can invoke a move\iref{class.copy.ctor}. \end{note} \pnum @@ -5120,7 +5120,7 @@ \pnum \indextext{initialization!array of class objects}% \begin{note} -An aggregate array or an aggregate class may contain elements of a +An aggregate array or an aggregate class can contain elements of a class type with a user-declared constructor\iref{class.ctor}. Initialization of these aggregate objects is described in~\ref{class.expl.init}. \end{note} @@ -6081,7 +6081,7 @@ shall provide implicit definitions for them~(\ref{class.ctor}, \ref{class.dtor}, \ref{class.copy.ctor}, \ref{class.copy.assign}), -which might mean defining them as deleted. +including possibly defining them as deleted. A defaulted prospective destructor\iref{class.dtor} that is not a destructor is defined as deleted. A defaulted special member function @@ -7269,7 +7269,7 @@ \begin{note} An explicit instantiation\iref{temp.explicit} or explicit specialization\iref{temp.expl.spec} of a template -does not introduce a name and thus may be declared using an +does not introduce a name and thus can be declared using an \grammarterm{unqualified-id} in a member of the enclosing namespace set, if the primary template is declared in an inline namespace. \end{note} @@ -7594,7 +7594,7 @@ An ambiguity exists if the best match finds two functions with the same signature, even if one is in a namespace reachable through \grammarterm{using-directive}{s} in the namespace of the other.\footnote{During -name lookup in a class hierarchy, some ambiguities may be +name lookup in a class hierarchy, some ambiguities can be resolved by considering whether one member hides the other along some paths\iref{class.member.lookup}. There is no such disambiguation when considering the set of names found as a result of following @@ -7944,7 +7944,7 @@ as a function template introduced by a \grammarterm{using-declaration}, the program is ill-formed. \begin{note} -Two \grammarterm{using-declaration}{s} may introduce functions with the same +Two \grammarterm{using-declaration}{s} can introduce functions with the same name and the same parameter-type-list. If, for a call to an unqualified function name, function overload resolution selects the functions introduced by such \grammarterm{using-declaration}{s}, the function call is @@ -8169,7 +8169,7 @@ \begin{note} Some of the properties associated with an entity with language linkage are specific to each implementation and are not described here. For -example, a particular language linkage may be associated with a +example, a particular language linkage might be associated with a particular form of representing names of objects and functions with external linkage, or with a particular calling convention, etc. \end{note} @@ -8340,7 +8340,7 @@ \begin{note} Only one definition for an entity with a given name -with C language linkage may appear in the +with C language linkage can appear in the program (see~\ref{basic.def.odr}); this implies that such an entity must not be defined in more @@ -8562,10 +8562,8 @@ its \grammarterm{attribute-namespace} is \tcode{std} followed by zero or more digits. \end{itemize} -\begin{note} Each implementation should choose a distinctive name for the \grammarterm{attribute-namespace} in an \grammarterm{attribute-scoped-token}. -\end{note} \pnum Two consecutive left square bracket tokens shall appear only @@ -8720,7 +8718,7 @@ \pnum \begin{note} The \tcode{carries_dependency} attribute does not change the meaning of the -program, but may result in generation of more efficient code. +program, but might result in generation of more efficient code. \end{note} \pnum @@ -8788,7 +8786,7 @@ \end{ncbnf} \begin{note} The \grammarterm{string-literal} in the \grammarterm{attribute-argument-clause} -could be used to explain the rationale for deprecation and/or to suggest a replacing entity. +can be used to explain the rationale for deprecation and/or to suggest a replacing entity. \end{note} \pnum diff --git a/source/diagnostics.tex b/source/diagnostics.tex index e94081e151..93b0fd6e40 100644 --- a/source/diagnostics.tex +++ b/source/diagnostics.tex @@ -843,9 +843,10 @@ \begin{note} \tcode{error_category} objects are passed by reference, and two such objects -are equal if they have the same address. This means that applications using -custom \tcode{error_category} types should create a single object of each -such type. +are equal if they have the same address. +If there is more than a single object of a custom \tcode{error_category} type, +such equality comparisons can evaluate to \tcode{false} +even for objects holding the same value. \end{note} \indexlibraryglobal{error_category}% @@ -1050,7 +1051,7 @@ system is unspecified. \begin{note} The number of potential system error codes is large -and unbounded, and some may not correspond to any POSIX \tcode{errno} value. Thus +and unbounded, and some might not correspond to any POSIX \tcode{errno} value. Thus implementations are given latitude in determining correspondence. \end{note} \end{itemdescr} diff --git a/source/exceptions.tex b/source/exceptions.tex index 76526747bb..9e7e3d5f20 100644 --- a/source/exceptions.tex +++ b/source/exceptions.tex @@ -355,8 +355,8 @@ \end{codeblock} \end{example} \begin{note} -\setlength{\emergencystretch}{1em} -Consequently, destructors should generally catch exceptions and not let them propa\-gate. +If a destructor directly invoked by stack unwinding exits via an exception, +\tcode{std::terminate} is invoked. \end{note} diff --git a/source/expressions.tex b/source/expressions.tex index b1d94c74a8..6518b70a20 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -73,7 +73,7 @@ \indextext{operator!precedence of}% \indextext{expression!order of evaluation of}% \begin{note} -The implementation may regroup operators according to +The implementation can regroup operators according to the usual mathematical rules only where the operators really are associative or commutative.\footnote{Overloaded operators are never assumed to be associative or commutative.} @@ -272,7 +272,7 @@ that class shall not be an abstract class\iref{class.abstract}. A glvalue shall not have type \cv{}~\tcode{void}. \begin{note} -A glvalue may have complete or incomplete non-\tcode{void} type. +A glvalue can have complete or incomplete non-\tcode{void} type. Class and array prvalues can have cv-qualified types; other prvalues always have cv-unqualified types. See \ref{expr.type}. \end{note} @@ -292,7 +292,7 @@ whose type is not similar\iref{conv.qual} to one of the following types the behavior is undefined:\footnote{The intent of this list is to specify those circumstances in which an -object may or may not be aliased.} +object can or cannot be aliased.} \begin{itemize} \item the dynamic type of the object, @@ -422,7 +422,7 @@ \ref{temp.concept}). An unevaluated operand is not evaluated. \begin{note} -In an unevaluated operand, a non-static class member may be +In an unevaluated operand, a non-static class member can be named\iref{expr.prim.id} and naming of objects or functions does not, by itself, require that a definition be provided\iref{basic.def.odr}. An unevaluated operand is considered a full-expression\iref{intro.execution}. @@ -1745,7 +1745,7 @@ \pnum \begin{note} -The function call operator or operator template may be constrained\iref{temp.constr.decl} +The function call operator or operator template can be constrained\iref{temp.constr.decl} by a \grammarterm{type-constraint}\iref{temp.param}, a \grammarterm{requires-clause}\iref{temp.pre}, or a trailing \grammarterm{requires-clause}\iref{dcl.decl}. @@ -2845,7 +2845,7 @@ The \tcode{>} token following the \grammarterm{type-id} in a \tcode{dynamic_cast}, \tcode{static_cast}, \tcode{reinterpret_cast}, or -\tcode{const_cast} may be the product of replacing a +\tcode{const_cast} might be the product of replacing a \tcode{>{>}} token by two consecutive \tcode{>} tokens\iref{temp.names}. \end{note} @@ -3932,7 +3932,7 @@ \pnum An object pointer can be explicitly converted to an object pointer of a different type.\footnote{The -types may have different \cv-qualifiers, subject to +types can have different \cv-qualifiers, subject to the overall restriction that a \tcode{reinterpret_cast} cannot cast away constness.} When a prvalue \tcode{v} of object pointer type is converted to @@ -3970,7 +3970,7 @@ A prvalue of type ``pointer to member of \tcode{X} of type \tcode{T1}'' can be explicitly converted to a prvalue of a different type ``pointer to member of \tcode{Y} of type \tcode{T2}'' if \tcode{T1} and \tcode{T2} are both -function types or both object types.\footnote{\tcode{T1} and \tcode{T2} may have +function types or both object types.\footnote{\tcode{T1} and \tcode{T2} can have different \cv-qualifiers, subject to the overall restriction that a \tcode{reinterpret_cast} cannot cast away constness.} The null member pointer value\iref{conv.mem} is converted to the @@ -4026,7 +4026,7 @@ \pnum \begin{note} -Subject to the restrictions in this subclause, an expression may be cast +Subject to the restrictions in this subclause, an expression can be cast to its own type using a \tcode{const_cast} operator. \end{note} @@ -4082,7 +4082,7 @@ \tcode{const_cast} that casts away a const-qualifier\footnote{\tcode{const_cast} is not limited to conversions that cast away a const-qualifier.} -may produce undefined behavior\iref{dcl.type.cv}. +might produce undefined behavior\iref{dcl.type.cv}. \end{note} \pnum @@ -4457,7 +4457,7 @@ \begin{note} This resumes the coroutine referred to by the result of \placeholder{await-suspend}. -Any number of coroutines may be successively resumed in this fashion, +Any number of coroutines can be successively resumed in this fashion, eventually returning control flow to the current coroutine caller or resumer\iref{dcl.fct.def.coroutine}. \end{note} @@ -4570,7 +4570,7 @@ potentially-overlapping subobject is the size of the type, not the size of the subobject.% \footnote{The actual size of a potentially-overlapping subobject -may be less than the result of +can be less than the result of applying \tcode{sizeof} to the subobject, due to virtual base classes and less strict padding requirements on potentially-overlapping subobjects.} \indextext{array!\idxcode{sizeof}}% @@ -4684,7 +4684,7 @@ \grammarterm{new-expression}{s}. \end{note} \begin{note} -The \grammarterm{type-id} may be a cv-qualified type, in which case the +The \grammarterm{type-id} can be a cv-qualified type, in which case the object created by the \grammarterm{new-expression} has a cv-qualified type. \end{note} @@ -4915,9 +4915,9 @@ A \Cpp{} program can provide alternative definitions of these functions\iref{replacement.functions} and/or class-specific versions\iref{class.free}. -The set of allocation and deallocation functions that may be called +The set of allocation and deallocation functions that can be called by a \grammarterm{new-expression} -may include functions that do not perform allocation or deallocation; +could include functions that do not perform allocation or deallocation; for example, see \ref{new.delete.placement}. \end{note} @@ -5171,7 +5171,7 @@ \pnum \indextext{\idxcode{new}!exception and}% -If any part of the object initialization described above\footnote{This may +If any part of the object initialization described above\footnote{This might include evaluating a \grammarterm{new-initializer} and/or calling a constructor.} terminates by throwing an exception and a suitable deallocation function @@ -6728,7 +6728,7 @@ \begin{note} This restriction applies to the relationship between the left and right sides of the assignment operation; it is not a -statement about how the target of the assignment may be aliased in general. +statement about how the target of the assignment might be aliased in general. See~\ref{basic.lval}. \end{note} @@ -6842,7 +6842,7 @@ for \tcode{o} and its subobjects even if those objects are of non-literal class types. \begin{note} - Such a class may have a non-trivial destructor. + Such a class can have a non-trivial destructor. Within this evaluation, \tcode{std::is_constant_evaluated()}\iref{meta.const.eval} returns \tcode{true}. @@ -7159,7 +7159,7 @@ is an expression of integral or unscoped enumeration type, implicitly converted to a prvalue, where the converted expression is a core constant expression. \begin{note} -Such expressions may be +Such expressions can be used as bit-field lengths\iref{class.bit}, as enumerator initializers if the underlying type is not fixed\iref{dcl.enum}, and as alignments\iref{dcl.align}. @@ -7206,7 +7206,7 @@ \end{itemize} and where the reference binding (if any) binds directly. \begin{note} -Such expressions may be used in \tcode{new} +Such expressions can be used in \tcode{new} expressions\iref{expr.new}, as case expressions\iref{stmt.switch}, as enumerator initializers if the underlying type is fixed\iref{dcl.enum}, as array bounds\iref{dcl.array}, and @@ -7264,14 +7264,16 @@ \end{example} \pnum +\recommended +Implementations should provide consistent results of floating-point evaluations, +irrespective of whether the evaluation is performed +during translation or during program execution. \begin{note} Since this document imposes no restrictions on the accuracy of floating-point operations, it is unspecified whether the evaluation of a floating-point expression during translation yields the same result as the evaluation of the same expression (or the same operations on the same values) during program -execution.\footnote{Nonetheless, implementations should provide consistent results, -irrespective of whether the evaluation was performed during translation and/or during program -execution.} +execution. \begin{example} \begin{codeblock} bool f() { @@ -7308,7 +7310,7 @@ that is usable in constant expressions or has constant initialization\iref{basic.start.static}.% \footnote{Testing this condition -may involve a trial evaluation of its initializer as described above.} +might involve a trial evaluation of its initializer as described above.} \begin{example} \begin{codeblock} template struct X {}; @@ -7349,12 +7351,12 @@ \item an immediate subexpression of a \grammarterm{braced-init-list},% -\footnote{Constant evaluation may be necessary to determine whether a narrowing conversion is performed\iref{dcl.init.list}.} +\footnote{Constant evaluation might be necessary to determine whether a narrowing conversion is performed\iref{dcl.init.list}.} \item an expression of the form \tcode{\&} \grammarterm{cast-expression} that occurs within a templated entity,% -\footnote{Constant evaluation may be necessary to determine whether such an expression is value-dependent\iref{temp.dep.constexpr}.} +\footnote{Constant evaluation might be necessary to determine whether such an expression is value-dependent\iref{temp.dep.constexpr}.} or \item diff --git a/source/future.tex b/source/future.tex index c50d4fbd6b..89e01922b9 100644 --- a/source/future.tex +++ b/source/future.tex @@ -570,7 +570,7 @@ \begin{itemize} \item \tcode{allocated}, set when a dynamic array object has been -allocated, and hence should be freed by the destructor for the +allocated, and hence will be freed by the destructor for the \tcode{strstreambuf} object; \item \tcode{constant}, set when the array object has @@ -865,8 +865,6 @@ How many additional write positions are made available is otherwise unspecified.% \indextext{unspecified}% -\footnote{An implementation should consider \tcode{alsize} in making this -decision.} If \tcode{palloc} is not a null pointer, the function calls \tcode{(*palloc)(n)} to allocate the new dynamic array object. @@ -890,6 +888,11 @@ or if \tcode{(strmode \& frozen) != 0}, the function cannot extend the array (reallocate it with greater length) to make a write position available. + +\pnum +\recommended +An implementation should consider \tcode{alsize} in making the +decision how many additional write positions to make available. \end{itemdescr} \indexlibrarymember{pbackfail}{strstreambuf}% @@ -2742,7 +2745,7 @@ an atomic variable of static storage duration of a type that is initialization-compatible with \tcode{value}. \begin{note} -This operation may need to initialize locks. +This operation might need to initialize locks. \end{note} Concurrent access to the variable being initialized, even via an atomic operation, diff --git a/source/intro.tex b/source/intro.tex index fe1547ed41..7c1f11b66f 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -884,7 +884,7 @@ \defnx{observable behavior}{behavior!observable} of the program. \begin{note} More stringent correspondences between abstract and actual -semantics may be defined by each implementation. +semantics can be defined by each implementation. \end{note} \rSec1[intro.structure]{Structure of this document} diff --git a/source/iostreams.tex b/source/iostreams.tex index fe262d2f7e..6e33dfec5a 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -430,8 +430,12 @@ The objects are constructed and the associations are established at some time prior to or during the first time an object of class \tcode{ios_base::Init} is constructed, and in any case before the body -of \tcode{main}\iref{basic.start.main} begins execution.\footnote{If it is possible for them to do so, implementations should -initialize the objects earlier than required.} +of \tcode{main}\iref{basic.start.main} begins execution. + +\recommended +If it is possible for them to do so, implementations should +initialize the objects earlier than required. + The objects are not destroyed during program execution.\footnote{Constructors and destructors for objects with static storage duration can access these objects to read input from @@ -441,6 +445,13 @@ or \tcode{stderr}. } + +\pnum +\recommended +If it is possible for them to do so, implementations should +initialize the objects earlier than required. + +\pnum The results of including \libheader{iostream} in a translation unit shall be as if \libheader{iostream} defined an instance of \tcode{ios_base::Init} with static storage duration. @@ -3040,7 +3051,7 @@ Initializes:\footnote{The default constructor is protected for class \tcode{basic_streambuf} to assure that only objects for classes -derived from this class may be constructed.} +derived from this class can be constructed.} \begin{itemize} \item all pointer member objects to null pointers, @@ -6138,7 +6149,7 @@ to generate the requested output. If the generation fails, then the formatted output function does \tcode{setstate(ios_base::failbit)}, -which might throw an exception. +which can throw an exception. If an exception is thrown during output, then \tcode{ios_base::badbit} is turned on\footnote{without causing an @@ -9620,8 +9631,8 @@ \pnum \remarks An -implementation might well provide an overriding definition for this function -signature if it can determine that more characters can be read from the input +implementation may provide an overriding definition for this function +signature if it can determine whether more characters can be read from the input sequence. \end{itemdescr} @@ -11147,8 +11158,8 @@ \pnum \begin{note} The member functions of the provided stream buffer -might be called from \tcode{emit()} while a lock is held. -Care should be taken to ensure that this does not result in deadlock. +can be called from \tcode{emit()} while a lock is held, +which might result in a deadlock if used incautiously. \end{note} \pnum @@ -11982,7 +11993,7 @@ the ASCII control characters (0x00 -- 0x1F) in filenames. \end{example} \begin{note} -For wide portability, users may wish to limit \grammarterm{filename} +Wider portability can be achieved by limiting \grammarterm{filename} characters to the POSIX Portable Filename Character Set: \\ \tcode{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} \\ \tcode{a b c d e f g h i j k l m n o p q r s t u v w x y z} \\ @@ -12085,7 +12096,7 @@ \pnum \begin{note} -Some operating systems may have no unambiguous way to distinguish between native format and generic format arguments. +Some operating systems have no unambiguous way to distinguish between native format and generic format arguments. This is by design as it simplifies use for operating systems that do not require disambiguation. An implementation for an operating system where disambiguation is required is permitted to distinguish between the formats. @@ -12114,7 +12125,7 @@ A path stores a native format pathname\iref{fs.path.native.obs} and acts as if it also stores a generic format pathname, related as given below. -The implementation may generate the generic format pathname +The implementation can generate the generic format pathname based on the native format pathname (and possibly other information) when requested. \end{note} @@ -12569,7 +12580,7 @@ Appends \tcode{path(x).native()} to the pathname in the native format. \begin{note} This directly manipulates the value of \tcode{native()} -and may not be portable between operating systems. +and might not be portable between operating systems. \end{note} \pnum @@ -13103,7 +13114,7 @@ \pnum \begin{note} On non-POSIX operating systems, for a path \tcode{p}, -it may not be the case that \tcode{p.stem() + p.extension() == p.filename()}, +it is possible that \tcode{p.stem() + p.extension() == p.filename()} is \tcode{false}, even though the generic format pathnames are the same. \end{note} \end{itemdescr} @@ -13707,10 +13718,10 @@ \impldef{interpretation of the path character sequence with format \tcode{path::auto_format}}. The implementation may inspect the content of the character sequence to determine the format. - \begin{note} + + \recommended For POSIX-based systems, native and generic formats are equivalent and the character sequence should always be interpreted in the same way. - \end{note} \\\rowsep \end{floattable} @@ -14610,11 +14621,11 @@ \pnum \begin{note} -Programs performing directory iteration may wish to test if the -path obtained by dereferencing a directory iterator actually exists. It could be -a symbolic link to a non-existent file. Programs recursively -walking directory trees for purposes of removing and renaming entries may wish -to avoid following symbolic links. +A path obtained by dereferencing a directory iterator might not actually exist; +it could be a symbolic link to a non-existent file. +Recursively walking directory trees +for purposes of removing and renaming entries +might invalidate symbolic links that are being followed. \end{note} \pnum @@ -14823,7 +14834,7 @@ \pnum \begin{note} If the directory structure being iterated over contains cycles -then the end iterator may be unreachable. +then the end iterator might be unreachable. \end{note} \rSec3[fs.rec.dir.itr.members]{Members} @@ -15135,9 +15146,9 @@ \pnum \begin{note} Because hardware failures, network failures, file system races\iref{fs.race.behavior}, -and many other kinds of errors occur frequently in file system operations, users should be aware -that any filesystem operation function, no matter how apparently innocuous, may encounter -an error; see~\ref{fs.err.report}. +and many other kinds of errors occur frequently in file system operations, +any filesystem operation function, no matter how apparently innocuous, +can encounter an error; see~\ref{fs.err.report}. \end{note} \rSec3[fs.op.absolute]{Absolute} @@ -15628,7 +15639,9 @@ \pnum \begin{note} Some operating systems require symlink creation to - identify that the link is to a directory. Portable code should use \tcode{create_directory_symlink()} to create directory symlinks rather than \tcode{create_symlink()} +identify that the link is to a directory. +Thus, \tcode{create_symlink()} (instead of \tcode{create_directory_symlink()}) +cannot be used reliably to create directory symlinks. \end{note} \pnum @@ -15744,7 +15757,7 @@ \pnum \begin{note} The current path as returned by many operating systems is a dangerous - global variable. It may be changed unexpectedly by third-party or system + global variable. It might be changed unexpectedly by third-party or system library functions, or by another thread. \end{note} \end{itemdescr} @@ -15771,7 +15784,7 @@ \pnum \begin{note} The current path for many operating systems is a dangerous - global state. It may be changed unexpectedly by a third-party or system + global state. It might be changed unexpectedly by a third-party or system library functions, or by another thread. \end{note} \end{itemdescr} @@ -16295,7 +16308,7 @@ \pnum \begin{note} Conceptually permissions are viewed as bits, but the actual -implementation may use some other mechanism. +implementation can use some other mechanism. \end{note} \pnum @@ -16496,13 +16509,13 @@ \begin{itemize} \item If \tcode{old_p} and \tcode{new_p} resolve to the same existing file, no action is taken. -\item Otherwise, the rename may include the following effects: +\item Otherwise, the rename can include the following effects: \begin{itemize} \item if \tcode{new_p} resolves to an existing non-directory file, \tcode{new_p} is removed; otherwise, \item if \tcode{new_p} resolves to an existing directory, \tcode{new_p} is removed if empty on POSIX compliant operating systems - but may be an error on other operating systems. + but might be an error on other operating systems. \end{itemize} \end{itemize} A symbolic link is itself renamed, rather than the file it resolves to. @@ -16565,7 +16578,7 @@ The value of member \tcode{space_info::available} is operating system dependent. \begin{note} -\tcode{available} may be +\tcode{available} might be less than \tcode{free}. \end{note} \end{itemdescr} diff --git a/source/iterators.tex b/source/iterators.tex index 09cc970573..64023444ee 100644 --- a/source/iterators.tex +++ b/source/iterators.tex @@ -596,7 +596,7 @@ that designate the beginning and end of the computation, or an iterator and a count that designate the beginning and the number of elements to which the computation is to be applied.\footnote{The sentinel denoting the end of a range -may have the same type as the iterator denoting the beginning of the range, or a +can have the same type as the iterator denoting the beginning of the range, or a different type.} \pnum @@ -1435,11 +1435,15 @@ \end{itemize} \pnum +\recommended +The implementaton of an algorithm on a weakly incrementable type +should never attempt to pass through the same incrementable value twice; +such an algorithm should be a single-pass algorithm. \begin{note} For \libconcept{weakly_incrementable} types, \tcode{a} equals \tcode{b} does not imply that \tcode{++a} equals \tcode{++b}. (Equality does not guarantee the substitution property or referential -transparency.) Algorithms on weakly incrementable types should never attempt to pass -through the same incrementable value twice. They should be single-pass algorithms. These algorithms +transparency.) +Such algorithms can be used with istreams as the source of the input data through the \tcode{istream_iterator} class template. \end{note} @@ -1667,10 +1671,10 @@ \end{codeblock} \pnum -\begin{note} -Algorithms on output iterators should never attempt to pass through the same iterator twice. -They should be single-pass algorithms. -\end{note} +\recommended +The implementation of an algorithm on output iterators +should never attempt to pass through the same iterator twice; +such an algorithm should be a single-pass algorithm. \rSec3[iterator.concept.forward]{Concept \cname{forward_iterator}} @@ -2013,18 +2017,15 @@ \end{libreqtab4b} \pnum +\recommended +The implementation of an algorithm on input iterators +should never attempt to pass through the same iterator twice; +such an algorithm should be a single pass algorithm. \begin{note} -For input iterators, -\tcode{a == b} -does not imply -\tcode{++a == ++b}. +For input iterators, \tcode{a == b} does not imply \tcode{++a == ++b}. (Equality does not guarantee the substitution property or referential transparency.) -Algorithms on input iterators should never attempt to pass through the same iterator twice. -They should be -\term{single pass} -algorithms. Value type \tcode{T} is not required to be a \oldconcept{CopyAssignable} type (\tref{cpp17.copyassignable}). -These algorithms can be used with istreams as the source of the input data through the +Such an algorithm can be used with istreams as the source of the input data through the \tcode{istream_iterator} class template. \end{note} @@ -2074,13 +2075,14 @@ \end{libreqtab4b} \pnum +\recommended +The implementation of an algorithm on output iterators +should never attempt to pass through the same iterator twice; +such an algorithm should be a single-pass algorithm. \begin{note} -The only valid use of an -\tcode{operator*} +The only valid use of an \tcode{operator*} is on the left side of the assignment statement. Assignment through the same value of the iterator happens only once. -Algorithms on output iterators should never attempt to pass through the same iterator twice. -They should be single-pass algorithms. Equality and inequality might not be defined. \end{note} diff --git a/source/lex.tex b/source/lex.tex index b595000428..a0fae05baa 100644 --- a/source/lex.tex +++ b/source/lex.tex @@ -57,8 +57,8 @@ \pnum \indextext{translation!phases|(}% The precedence among the syntax rules of translation is specified by the -following phases.\footnote{Implementations must behave as if these separate phases -occur, although in practice different phases might be folded together.} +following phases.\footnote{Implementations behave as if these separate phases +occur, although in practice different phases can be folded together.} \begin{enumerate} \item @@ -143,7 +143,7 @@ token\iref{lex.token}. The resulting tokens are syntactically and semantically analyzed and translated as a translation unit. \begin{note} -The process of analyzing and translating the tokens may occasionally +The process of analyzing and translating the tokens can occasionally result in one token being replaced by a sequence of other tokens\iref{temp.names}. \end{note} @@ -168,13 +168,13 @@ \item Translated translation units and instantiation units are combined as follows: \begin{note} -Some or all of these may be supplied from a +Some or all of these can be supplied from a library. \end{note} Each translated translation unit is examined to produce a list of required instantiations. \begin{note} -This may include +This can include instantiations which have been explicitly requested\iref{temp.explicit}. \end{note} @@ -184,7 +184,7 @@ source of the translation units containing these definitions is required to be available. \begin{note} -An implementation could encode sufficient +An implementation can choose to encode sufficient information into the translated translation unit so as to ensure the source is not required here. \end{note} @@ -637,9 +637,9 @@ specified in \tref{lex.name.disallowed}. Upper- and lower-case letters are different. All characters are significant.\footnote{On systems in which linkers cannot accept extended -characters, an encoding of the \grammarterm{universal-character-name} may be used in +characters, an encoding of the \grammarterm{universal-character-name} can be used in forming valid external identifiers. For example, some otherwise unused -character or sequence of characters may be used to encode the +character or sequence of characters can be used to encode the \tcode{\textbackslash u} in a \grammarterm{universal-character-name}. Extended characters may produce a long external identifier, but \Cpp{} does not place a translation limit on significant characters for external @@ -1394,7 +1394,7 @@ actual extended character is encountered in the source text. Therefore, all extended characters are described in terms of \grammarterm{universal-character-name}{s}. However, -the actual compiler implementation may use its own native character set, +the actual compiler implementation can use its own native character set, so long as the same results are obtained. \end{note} diff --git a/source/lib-intro.tex b/source/lib-intro.tex index f0fe395a87..93b6b35a49 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -851,7 +851,7 @@ or namespaces nested within namespace \tcode{std}.\footnote{The C standard library headers\iref{depr.c.headers} also define names within the global namespace, while the \Cpp{} headers for C library -facilities\iref{headers} may also define names within the global namespace.}% +facilities\iref{headers} can also define names within the global namespace.}% \indextext{namespace} It is unspecified whether names declared in a specific namespace are declared directly in that namespace or in an inline namespace inside that @@ -1583,7 +1583,7 @@ of type \tcode{P} may have an indeterminate value. \begin{note} Operations involving -indeterminate values may cause undefined behavior. +indeterminate values might cause undefined behavior. \end{note} \pnum @@ -1668,11 +1668,9 @@ Thus all evaluations of the expression \tcode{h(k)} with the same value for \tcode{k} yield the same result for a given execution of the program. \end{note} -\begin{note} -For two different + For two different values \tcode{t1} and \tcode{t2}, the probability that \tcode{h(t1)} and \tcode{h(t2)} compare equal should be very small, approaching \tcode{1.0 / numeric_limits::max()}. - \end{note} \\ \rowsep \tcode{h(u)} & \tcode{size_t} & @@ -2050,7 +2048,7 @@ fail. The allocator also may silently ignore the requested alignment. \begin{note} Additionally, the member function \tcode{allocate} -for that type may fail by throwing an object of type +for that type can fail by throwing an object of type \tcode{bad_alloc}. \end{note} @@ -2211,7 +2209,7 @@ that meets the minimum requirements of this document. Therefore -an implementation may elect, +an implementation can elect, under the as-if rule\iref{intro.execution}, to provide any customization point in the form @@ -2777,7 +2775,7 @@ described in \ref{\firstlibchapter} through \ref{\lastlibchapter} and \ref{depr} shall behave as if the implementation declared no additional non-member function signatures.\footnote{A valid \Cpp{} program always -calls the expected library non-member function. An implementation may +calls the expected library non-member function. An implementation can also define additional non-member functions that would otherwise not be called by a valid \Cpp{} program.} @@ -2819,7 +2817,7 @@ an overload from the set of declarations described in this document behaves as if that overload were selected. \begin{note} -For instance, an implementation may add parameters with default values, +For instance, an implementation can add parameters with default values, or replace a member function with default arguments with two or more member functions with equivalent behavior, or add additional signatures for a member function name. @@ -3053,13 +3051,6 @@ Objects constructed by the standard library that may hold a user-supplied pointer value or an integer of type \tcode{std::intptr_t} shall store such values in a traceable pointer location\iref{basic.stc.dynamic.safety}. -\begin{note} -Other libraries are -strongly encouraged to do the same, since not doing so may result in accidental use of -pointers that are not safely derived. Libraries that store pointers outside the user's -address space should make it appear that they are stored and retrieved from a traceable -pointer location. -\end{note} \rSec3[value.error.codes]{Value of error codes} diff --git a/source/locales.tex b/source/locales.tex index 659313642e..09a8fb04f9 100644 --- a/source/locales.tex +++ b/source/locales.tex @@ -231,7 +231,7 @@ \begin{codeblock} operator()(const basic_string&, const basic_string&) \end{codeblock} -is provided so that a locale may be used as a predicate argument to +is provided so that a locale can be used as a predicate argument to the standard collections, to collate strings. \item Convenient global interfaces are provided for traditional @@ -2153,8 +2153,8 @@ constant number of \tcode{externT} characters needed to produce an internal character; or \tcode{0} if this number is not a constant.\footnote{If \tcode{encoding()} yields \tcode{-1}, then more than \tcode{max_length()} \tcode{externT} elements -may be consumed when producing a single \tcode{internT} character, and additional -\tcode{externT} elements may appear at the end of a sequence after those that +can be consumed when producing a single \tcode{internT} character, and additional +\tcode{externT} elements can appear at the end of a sequence after those that yield the final \tcode{internT} character.} \end{itemdescr} @@ -3448,11 +3448,12 @@ on any other string for which \tcode{do_compare()} returns 0 (equal) when passed the two strings. -\begin{note} + +\pnum +\recommended The probability that the result equals that for another string which does not compare equal should be very small, approaching \tcode{(1.0/numeric_limits::max())}. -\end{note} \end{itemdescr} \rSec3[locale.collate.byname]{Class template \tcode{collate_byname}} @@ -3748,7 +3749,7 @@ An enumeration value indicating the preferred order of components for those date formats that are composed of day, month, and year.\footnote{This function is intended as a convenience only, for common -formats, and may return +formats, and can return \tcode{no_order} in valid locales.} Returns @@ -4029,7 +4030,7 @@ \pnum \begin{note} -The \tcode{fill} argument may be used in the implementation-defined +The \tcode{fill} argument can be used in the implementation-defined formats or by derivations. A space character is a reasonable default for this argument. \end{note} @@ -4056,24 +4057,31 @@ interpreted identically as the format specifiers in the string argument to the standard library function \indexlibraryglobal{strftime}% -\tcode{strftime()}\footnote{Interpretation of the \tcode{modifier} -argument is implementation-defined, but should follow POSIX -conventions.}, +\tcode{strftime()}, except that the sequence of characters produced for those specifiers that are described as depending on the C locale are instead \impldef{formatted character sequence generated by \tcode{time_put::do_put} in C -locale}.\footnote{Implementations should refer to other standards -such as POSIX -for these definitions.} +locale}. +\begin{note} +Interpretation of the \tcode{modifier} +argument is implementation-defined. +\end{note} \pnum \returns An iterator pointing immediately after the last character produced. \begin{note} -The \tcode{fill} argument may be used in the implementation-defined +The \tcode{fill} argument can be used in the implementation-defined formats or by derivations. A space character is a reasonable default for this argument. \end{note} + +\pnum +\recommended +Interpretation of the \tcode{modifier} should follow POSIX conventions. +Implementations should refer to other standards such as POSIX +for a specification of the character sequences produced for +those specifiers described as depending on the C locale. \end{itemdescr} \rSec3[locale.time.put.byname]{Class template \tcode{time_put_byname}} diff --git a/source/modules.tex b/source/modules.tex index 3f5c04a721..27b4b2e901 100644 --- a/source/modules.tex +++ b/source/modules.tex @@ -526,7 +526,7 @@ non-exported \grammarterm{module-import-declaration}{s} in the module unit purview of $U$.\footnote{This is consistent with the rules for visibility of imported names\iref{basic.scope.namespace}.} -These rules may in turn lead to the importation of yet more +These rules can in turn lead to the importation of yet more translation units. \pnum diff --git a/source/numerics.tex b/source/numerics.tex index 5e64232eff..df7f90d8d9 100644 --- a/source/numerics.tex +++ b/source/numerics.tex @@ -2315,7 +2315,7 @@ \tcode{E(q)}% \indextext{constructor!random number engine requirement}\footnote{ This constructor (as well as the subsequent corresponding \tcode{seed()} function) - may be particularly useful + can be particularly useful to applications requiring a large number of independent random sequences. } @@ -4029,7 +4029,7 @@ is \impldef{type of \tcode{default_random_engine}}. \begin{note} The implementation - may select this type + can select this type on the basis of performance, size, quality, @@ -4037,7 +4037,7 @@ so as to provide at least acceptable engine behavior for relatively casual, inexpert, and/or lightweight use. Because different implementations - may select different underlying engine types, + can select different underlying engine types, code that uses this \tcode{typedef} need not generate identical sequences across implementations. \end{note} @@ -7124,7 +7124,7 @@ that has zero length.\footnote{This default constructor is essential, since arrays of \tcode{valarray} -may be useful. +can be useful. After initialization, the length of an empty array can be increased with the \tcode{resize} member function.} @@ -7380,8 +7380,8 @@ such that \tcode{i < a.size()} and \tcode{j < b.size()}. \begin{note} -This property indicates an absence of aliasing and may be used to -advantage by optimizing compilers. Compilers may take advantage +This property indicates an absence of aliasing and can be used to +advantage by optimizing compilers. Compilers can take advantage of inlining, constant propagation, loop fusion, tracking of pointers obtained from \tcode{operator new}, @@ -8175,7 +8175,7 @@ Such a slice is specified by a starting index, a length, and a stride.\footnote{BLAS stands for \textit{Basic Linear Algebra Subprograms.} -\Cpp{} programs may instantiate this class. +\Cpp{} programs can instantiate this class. See, for example, Dongarra, Du Croz, Duff, and Hammerling: \textit{A set of Level 3 Basic Linear Algebra Subprograms}; diff --git a/source/overloading.tex b/source/overloading.tex index b3a6663b24..3efff16769 100644 --- a/source/overloading.tex +++ b/source/overloading.tex @@ -732,7 +732,7 @@ which the \grammarterm{postfix-expression} ultimately contains a name that -denotes one or more functions that might be called. +denotes one or more functions. Such a \grammarterm{postfix-expression}, perhaps nested arbitrarily deep in @@ -985,7 +985,7 @@ \pnum If either operand has a type that is a class or an enumeration, a -user-defined operator function might be declared that implements +user-defined operator function can be declared that implements this operator or a user-defined conversion can be necessary to convert the operand to a type that is appropriate for a built-in operator. @@ -1233,7 +1233,7 @@ is applied to the value returned, with the original second operand.\footnote{If the value returned by the \tcode{\keyword{operator}->} -function has class type, this may result in selecting and calling another +function has class type, this can result in selecting and calling another \tcode{\keyword{operator}->} function. The process repeats until an @@ -4259,7 +4259,7 @@ function templates. In particular, they are looked up like ordinary functions and function templates and they follow the same overload resolution rules. Also, they can be declared \tcode{inline} or \tcode{constexpr}, -they may have internal, module, or external linkage, +they can have internal, module, or external linkage, they can be called explicitly, their addresses can be taken, etc. \end{note} diff --git a/source/preprocessor.tex b/source/preprocessor.tex index b5f0eb7d09..27f0f95e69 100644 --- a/source/preprocessor.tex +++ b/source/preprocessor.tex @@ -711,11 +711,12 @@ \pnum \begin{note} -Although an implementation may provide a mechanism for making arbitrary -source files available to the \tcode{< >} search, in general -programmers should use the \tcode{< >} form for headers provided -with the implementation, and the \tcode{" "} form for sources -outside the control of the implementation. For instance: +An implementation can provide a mechanism for making arbitrary +source files available to the \tcode{< >} search. +However, using the \tcode{< >} form for headers provided +with the implementation and the \tcode{" "} form for sources +outside the control of the implementation +achieves wider portability. For instance: \begin{codeblock} #include @@ -1605,7 +1606,7 @@ \end{ncsimplebnf} causes the implementation to behave in an \impldef{\tcode{\#pragma}} manner. -The behavior might cause translation to fail or cause the translator or +The behavior may cause translation to fail or cause the translator or the resulting program to behave in a non-conforming manner. Any pragma that is not recognized by the implementation is ignored. diff --git a/source/ranges.tex b/source/ranges.tex index a26a3dfd37..8687027c2f 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -1016,8 +1016,7 @@ \tcode{ranges::begin} and \tcode{ranges::end}. Since \tcode{ranges::begin} is not required to be equality-preserving when the return type does not model \libconcept{forward_iterator}, repeated calls -might not return equal values or might not be well-defined; -\tcode{ranges::begin} should be called at most once for such a range. +might not return equal values or might not be well-defined. \end{note} \end{itemdescr} diff --git a/source/regex.tex b/source/regex.tex index 28aae8bf5e..666bf793f2 100644 --- a/source/regex.tex +++ b/source/regex.tex @@ -3283,7 +3283,7 @@ \pnum \begin{note} -This means that a compiler may call an +This means that a compiler can call an implementation-specific search function, in which case a program-defined specialization of \tcode{regex_search} will not be called. diff --git a/source/statements.tex b/source/statements.tex index 49c3f1825f..abaf8fcb19 100644 --- a/source/statements.tex +++ b/source/statements.tex @@ -152,7 +152,7 @@ Labels have their own name space and do not interfere with other identifiers. \begin{note} -A label may have the same name as another declaration in the same scope or a +A label can have the same name as another declaration in the same scope or a \grammarterm{template-parameter} from an enclosing scope. Unqualified name lookup\iref{basic.lookup.unqual} ignores labels. \end{note} @@ -835,7 +835,7 @@ A \tcode{return} statement can involve an invocation of a constructor to perform a copy or move of the operand if it is not a prvalue or if its type differs from the return type of the function. -A copy operation associated with a \tcode{return} statement may be elided or +A copy operation associated with a \tcode{return} statement can be elided or converted to a move operation if an automatic storage duration variable is returned\iref{class.copy.elision}. \end{note} \begin{example} diff --git a/source/strings.tex b/source/strings.tex index 0f4f956ee8..983a8d8160 100644 --- a/source/strings.tex +++ b/source/strings.tex @@ -3286,7 +3286,7 @@ are left in valid but unspecified states. \begin{note} If \tcode{lhs} and \tcode{rhs} have equal allocators, -the implementation may move from either. +the implementation can move from either. \end{note} \end{itemdescr} @@ -3947,7 +3947,7 @@ \pnum \begin{note} The library provides implicit conversions from \tcode{const charT*} and \tcode{std::basic_string} to \tcode{std::basic_string_view} so that user code can accept just \tcode{std::basic_string_view} as a non-templated parameter wherever a sequence of characters is expected. -User-defined types should define their own implicit conversions to \tcode{std::basic_string_view} in order to interoperate with these functions. +User-defined types can define their own implicit conversions to \tcode{std::basic_string_view} in order to interoperate with these functions. \end{note} \rSec2[string.view.synop]{Header \tcode{} synopsis} @@ -4450,7 +4450,7 @@ \pnum \begin{note} Unlike \tcode{basic_string::data()} and \grammarterm{string-literal}s, -\tcode{data()} may return a pointer to a buffer that is not null-terminated. +\tcode{data()} can return a pointer to a buffer that is not null-terminated. Therefore it is typically a mistake to pass \tcode{data()} to a function that takes just a \tcode{const charT*} and expects a null-terminated string. \end{note} \end{itemdescr} diff --git a/source/support.tex b/source/support.tex index a727176540..333cbaa9ec 100644 --- a/source/support.tex +++ b/source/support.tex @@ -1948,13 +1948,13 @@ data race\iref{res.on.data.races}. \end{note} \begin{note} -The order of registration may be indeterminate if \tcode{at_quick_exit} was called from more +The order of registration could be indeterminate if \tcode{at_quick_exit} was called from more than one thread. \end{note} \begin{note} The \tcode{at_quick_exit} registrations are distinct from the \tcode{atexit} registrations, -and applications may need to call both registration functions with the same argument. +and applications might need to call both registration functions with the same argument. \end{note} \pnum @@ -1985,7 +1985,7 @@ A function registered via \tcode{at_quick_exit} is invoked by the thread that calls \tcode{quick_exit}, which can be a different thread -than the one that registered it, so registered functions should not rely on the identity +than the one that registered it, so registered functions cannot rely on the identity of objects with thread storage duration. \end{note} After calling registered functions, \tcode{quick_exit} shall call \tcode{_Exit(status)}. @@ -2234,7 +2234,7 @@ the program shall also define the corresponding version without the \tcode{size} parameter. \begin{note} -The default behavior below may change in the future, which will require +The default behavior below might change in the future, which will require replacing both deallocation functions when replacing the allocation function. \end{note} @@ -2487,7 +2487,7 @@ the program shall also define the corresponding version without the \tcode{size} parameter. \begin{note} -The default behavior below may change in the future, which will require +The default behavior below might change in the future, which will require replacing both deallocation functions when replacing the allocation function. \end{note} @@ -2841,7 +2841,7 @@ \returns The current \tcode{new_handler}. \begin{note} -This may be a null pointer value. +This can be a null pointer value. \end{note} \end{itemdescr} @@ -3591,7 +3591,7 @@ \returns The current \tcode{terminate_handler}. \begin{note} -This may be a null pointer value. +This can be a null pointer value. \end{note} \end{itemdescr} @@ -3683,7 +3683,7 @@ \begin{note} If \tcode{rethrow_exception} rethrows the same exception object (rather than a copy), -concurrent access to that rethrown exception object may introduce a data race. +concurrent access to that rethrown exception object can introduce a data race. Changes in the number of \tcode{exception_ptr} objects that refer to a particular exception do not introduce a data race. \end{note} @@ -3715,7 +3715,7 @@ if this is not possible, to an instance of \tcode{bad_exception}. \begin{note} The -copy constructor of the thrown exception may also fail, so the implementation is allowed +copy constructor of the thrown exception can also fail, so the implementation is allowed to substitute a \tcode{bad_exception} object to avoid infinite recursion. \end{note} @@ -5142,7 +5142,7 @@ a mutex object across a suspend point. \end{note} \begin{note} -A concurrent resumption of the coroutine may result in a data race. +A concurrent resumption of the coroutine can result in a data race. \end{note} \indexlibrarymember{operator()}{coroutine_handle}% @@ -5403,8 +5403,8 @@ \pnum \begin{note} The types \tcode{suspend_never} and \tcode{suspend_always} can be used -to indicate that an \grammarterm{await-expression} should either never -suspend or always suspend, and in either case not produce a value. +to indicate that an \grammarterm{await-expression} either never +suspends or always suspends, and in either case does not produce a value. \end{note} \rSec1[support.runtime]{Other runtime support} diff --git a/source/templates.tex b/source/templates.tex index 6cb8cbd836..fc5cbc2567 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -53,7 +53,7 @@ The \tcode{>} token following the \grammarterm{template-parameter-list} of a \grammarterm{template-declaration} -may be the product of replacing a +can be the product of replacing a \tcode{>{>}} token by two consecutive \tcode{>} tokens\iref{temp.names}. \end{note} @@ -117,7 +117,7 @@ shall not be a \grammarterm{template-id}. \begin{note} -That last component may be an \grammarterm{identifier}, an \grammarterm{operator-function-id}, +That last component can be an \grammarterm{identifier}, an \grammarterm{operator-function-id}, a \grammarterm{conversion-function-id}, or a \grammarterm{literal-operator-id}. In a class template declaration, if the class name @@ -258,7 +258,7 @@ The \tcode{>} token following the \grammarterm{template-parameter-list} of a \grammarterm{type-parameter} -may be the product of replacing a +can be the product of replacing a \tcode{>{>}} token by two consecutive \tcode{>} tokens\iref{temp.names}. \end{note} @@ -326,7 +326,7 @@ \keyword{template}) in the scope of the template declaration. \begin{note} -A template argument may be a class template or alias template. +A template argument can be a class template or alias template. For example, \begin{codeblock} @@ -745,8 +745,8 @@ the \grammarterm{template-id}. \begin{note} The second \tcode{>} -token produced by this replacement rule may terminate an enclosing -\grammarterm{template-id} construct or it may be part of a different +token produced by this replacement rule could terminate an enclosing +\grammarterm{template-id} construct or it could be part of a different construct (e.g., a cast). \end{note} \begin{example} @@ -806,7 +806,7 @@ \begin{note} The keyword \keyword{template} -may not be applied to non-template members of class templates. +cannot be applied to non-template members of class templates. \end{note} \begin{note} As is the case with the @@ -1185,7 +1185,7 @@ \end{codeblock} \end{example} \begin{note} -A template type argument may be an incomplete type\iref{basic.types}. +A template type argument can be an incomplete type\iref{basic.types}. \end{note} \rSec2[temp.arg.nontype]{Template non-type arguments} @@ -2156,7 +2156,7 @@ refer to the same type only if their \grammarterm{expression}{s} are equivalent\iref{temp.over.link}. \begin{note} -However, such a type may be aliased, +However, such a type might be aliased, e.g., by a \grammarterm{typedef-name}. \end{note} @@ -3152,7 +3152,7 @@ \pnum \begin{note} -A friend declaration may first declare a member of an enclosing namespace scope\iref{temp.inject}. +A friend declaration can first declare a member of an enclosing namespace scope\iref{temp.inject}. \end{note} \pnum @@ -3370,7 +3370,7 @@ used to specify template arguments of the \grammarterm{simple-template-id} of the partial specialization. \begin{note} -The template arguments may be private types or +The template arguments can be private types or objects that would normally not be accessible. Dependent names cannot be checked when declaring the partial specialization, but will be checked when substituting into the partial specialization. @@ -3696,7 +3696,7 @@ the relationship between the template parameters and the rest of the signature. \begin{note} -Two distinct function templates may have identical function return types and +Two distinct function templates can have identical function return types and function parameter lists, even if overload resolution alone cannot distinguish them. @@ -3891,7 +3891,7 @@ \indextext{overloading!resolution!template}% \indextext{ordering!function template partial|see{template, function, partial ordering}}% If a function template is overloaded, -the use of a function template specialization might be ambiguous because +the use of a function template specialization can be ambiguous because template argument deduction\iref{temp.deduct} may associate the function template specialization with more than one function template declaration. \defnx{Partial ordering}{template!function!partial ordering} @@ -6057,7 +6057,7 @@ In particular, the template arguments and names used in the function declarator (including parameter types, return types and exception specifications) -may be private types or objects that would normally not be accessible. +can be private types or objects that would normally not be accessible. \end{note} \pnum @@ -6611,7 +6611,7 @@ or, where all template arguments can be deduced, a \grammarterm{template-name} or \grammarterm{operator-function-id}. \begin{note} -The declaration may declare a +The declaration can declare a \grammarterm{qualified-id}, in which case the \grammarterm{unqualified-id} @@ -7260,7 +7260,7 @@ the class template specialization to which the member function specialization belongs is implicitly instantiated. \begin{note} -Default function arguments may be specified in the declaration or +Default function arguments can be specified in the declaration or definition of a member function of a class template specialization that is explicitly specialized. \end{note} @@ -7717,7 +7717,7 @@ \pnum \begin{note} -Type deduction may fail for the following reasons: +Type deduction can fail for the following reasons: \begin{itemize} \item Attempting to instantiate a pack expansion containing multiple packs of differing lengths. \item diff --git a/source/threads.tex b/source/threads.tex index 51998e4add..cda362a5a0 100644 --- a/source/threads.tex +++ b/source/threads.tex @@ -126,10 +126,10 @@ An implementation returns from such a timeout at any point from the time specified above to the time it would return from a steady-clock relative timeout on the difference between $C_t$ and the time point of the call to the \tcode{_until} function. -\begin{note} + +\recommended Implementations should decrease the duration of the wait when the clock is adjusted forwards. -\end{note} \pnum \begin{note} @@ -2024,7 +2024,7 @@ \begin{note} Construction and destruction of an object of a mutex type need not be thread-safe; other -synchronization should be used to ensure that mutex objects are initialized +synchronization can be used to ensure that mutex objects are initialized and visible to other threads. \end{note} @@ -4240,11 +4240,8 @@ \pnum \begin{note} -The supplied lock will be held until the thread exits, and care -should be taken to ensure that this does not cause deadlock due to lock -ordering issues. After calling \tcode{notify_all_at_thread_exit} it is -recommended that the thread should be exited as soon as possible, and -that no blocking or time-consuming tasks are run on that thread. +The supplied lock is held until the thread exits, +which might cause deadlock due to lock ordering issues. \end{note} \pnum @@ -4332,7 +4329,7 @@ wait. This relaxes the usual rules, which would have required all wait calls to happen before destruction. Only the notification to unblock the wait needs to happen before destruction. -The user should take care to ensure that no threads wait on \tcode{*this} once the destructor has +Undefined behavior ensues if a thread waits on \tcode{*this} once the destructor has been started, especially when the waiting threads are calling the wait functions in a loop or using the overloads of \tcode{wait}, \tcode{wait_for}, or \tcode{wait_until} that take a predicate. \end{note} @@ -4689,8 +4686,8 @@ All of the standard mutex types meet this requirement. If a \tcode{Lock} type other than one of the standard mutex types or a \tcode{unique_lock} wrapper for a standard mutex type -is used with \tcode{condition_variable_any}, the user should ensure that any -necessary synchronization is in place with respect to the predicate associated +is used with \tcode{condition_variable_any}, any +necessary synchronization is assumed to be in place with respect to the predicate associated with the \tcode{condition_variable_any} instance. \end{note} @@ -4774,7 +4771,7 @@ wait. This relaxes the usual rules, which would have required all wait calls to happen before destruction. Only the notification to unblock the wait needs to happen before destruction. -The user should take care to ensure that no threads wait on \tcode{*this} once the destructor has +Undefined behavior ensues if a thread waits on \tcode{*this} once the destructor has been started, especially when the waiting threads are calling the wait functions in a loop or using the overloads of \tcode{wait}, \tcode{wait_for}, or \tcode{wait_until} that take a predicate. \end{note} @@ -6449,10 +6446,10 @@ \begin{note} It is valid to move from a future object for which \tcode{valid() == false}. \end{note} -\begin{note} + +\recommended Implementations should detect this case and throw an object of type \tcode{future_error} with an error condition of \tcode{future_errc::no_state}. -\end{note} \indexlibraryglobal{future}% \begin{codeblock} @@ -6749,10 +6746,10 @@ It is valid to copy or move from a \tcode{shared_future} object for which \tcode{valid()} is \tcode{false}. \end{note} -\begin{note} + +\recommended Implementations should detect this case and throw an object of type \tcode{future_error} with an error condition of \tcode{future_errc::no_state}. -\end{note} \indexlibraryglobal{shared_future}% \begin{codeblock} @@ -6926,7 +6923,7 @@ \pnum \begin{note} Access to a value object stored in the shared state is -unsynchronized, so programmers should apply only those operations on \tcode{R} that do not +unsynchronized, so operations on \tcode{R} might introduce a data race\iref{intro.multithread}. \end{note} @@ -7144,12 +7141,12 @@ deferred function in the thread that called the waiting function. Once evaluation of \tcode{invoke(std::move(g), std::move(xyz))} begins, the function is no longer considered deferred. -\begin{note} + +\recommended If this policy is specified together with other policies, such as when using a \tcode{policy} value of \tcode{launch::async | launch::deferred}, implementations should defer invocation or the selection of the policy when no more concurrency can be effectively exploited. -\end{note} \item If no value is set in the launch policy, or a value is set that is neither specified @@ -7163,8 +7160,7 @@ to the shared state created by this call to \tcode{async}. \begin{note} If a future obtained from \tcode{async} is moved outside the local scope, -other code that uses the future should be aware that the future's destructor can -block for the shared state to become ready. +the future's destructor can block for the shared state to become ready. \end{note} \pnum @@ -7236,7 +7232,7 @@ \begin{note} Line \#1 might not result in concurrency because -the \tcode{async} call uses the default policy, which may use +the \tcode{async} call uses the default policy, which might use \tcode{launch::deferred}, in which case the lambda might not be invoked until the \tcode{get()} call; in that case, \tcode{work1} and \tcode{work2} are called on the same thread and there is no concurrency. diff --git a/source/time.tex b/source/time.tex index 5cebb075da..a0dadad5b5 100644 --- a/source/time.tex +++ b/source/time.tex @@ -1058,7 +1058,7 @@ \pnum The \tcode{duration} template uses the \tcode{duration_values} trait to construct special values of the duration's representation (\tcode{Rep}). This is -done because the representation might be a class type with behavior which +done because the representation can be a class type with behavior that requires some other implementation to return these special values. In that case, the author of that class type should specialize \tcode{duration_values} to return the indicated values. @@ -1074,7 +1074,7 @@ \tcode{Rep(0)}. \begin{note} \tcode{Rep(0)} is specified instead of -\tcode{Rep()} because \tcode{Rep()} may have some other meaning, such as an +\tcode{Rep()} because \tcode{Rep()} can have some other meaning, such as an uninitialized value. \end{note} @@ -1140,7 +1140,7 @@ \tcode{duration} arguments will convert to it without requiring a division operation. The representation of this type is intended to be able to hold any value resulting from this conversion with no truncation error, although -floating-point durations may have round-off errors. +floating-point durations can have round-off errors. \end{note} \indexlibraryglobal{common_type}% @@ -3347,7 +3347,7 @@ Its epoch is unspecified, and \tcode{noexcept(file_clock::now())} is \tcode{true}. \begin{note} -The type that \tcode{file_clock} denotes may be +The type that \tcode{file_clock} denotes can be in a different namespace than \tcode{std::chrono}, such as \tcode{std::file\-sys\-tem}. \end{note} @@ -6382,7 +6382,7 @@ \tcode{d_} with \tcode{ymdl.day()}. \begin{note} This conversion from \tcode{year_month_day_last} to \tcode{year_month_day} -may be more efficient than converting a \tcode{year_month_day_last} to a \tcode{sys_days}, +might be more efficient than converting a \tcode{year_month_day_last} to a \tcode{sys_days}, and then converting that \tcode{sys_days} to a \tcode{year_month_day}. \end{note} \end{itemdescr} @@ -6690,7 +6690,7 @@ \begin{note} If \tcode{ymd.month()} is February and \tcode{ymd.day()} is not in the range \crange{1d}{28d}, -\tcode{ok()} may return \tcode{false} for +\tcode{ok()} can return \tcode{false} for the resultant \tcode{year_month_day}. \end{note} \end{itemdescr} @@ -6951,7 +6951,7 @@ \pnum \begin{note} -This value may be computed on demand. +This value might be computed on demand. \end{note} \end{itemdescr} diff --git a/source/utilities.tex b/source/utilities.tex index a9bf83a61e..a984dfeb6e 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -1978,7 +1978,7 @@ \pnum \begin{note} -An implementation may support additional types in the template parameter +An implementation can support additional types in the template parameter pack \tcode{Tuples} that support the \tcode{tuple}-like protocol, such as \tcode{pair} and \tcode{array}. \end{note} @@ -2288,7 +2288,7 @@ \pnum \begin{note} The above definition does not require \tcode{t$_{\mathrm{tail}}$} -(or \tcode{u$_{\mathrm{tail}}$}) to be constructed. It may not +(or \tcode{u$_{\mathrm{tail}}$}) to be constructed. It might not even be possible, as \tcode{t} and \tcode{u} are not required to be copy constructible. Also, all comparison operator functions are short circuited; they do not perform element accesses beyond what is required to determine the @@ -4580,7 +4580,7 @@ \tcode{t} are as defined by the exception safety guarantee of the assignment expression; \tcode{valueless_by_exception()} will be \tcode{false}. \item If an exception is thrown during the initialization of the contained value, -the \tcode{variant} object might not hold a value. +the \tcode{variant} object is permitted to not hold a value. \end{itemize} \end{itemdescr} @@ -4664,7 +4664,7 @@ \pnum \remarks If an exception is thrown during the initialization of the contained value, -the \tcode{variant} might not hold a value. +the \tcode{variant} is permitted to not hold a value. \end{itemdescr} \indexlibrarymember{emplace}{variant}% @@ -4705,7 +4705,7 @@ \pnum \remarks If an exception is thrown during the initialization of the contained value, -the \tcode{variant} might not hold a value. +the \tcode{variant} is permitted to not hold a value. \end{itemdescr} \rSec3[variant.status]{Value status} @@ -5274,7 +5274,7 @@ \pnum \begin{note} -The discriminated type may contain values of different types but does not attempt conversion between them, +The discriminated type can contain values of different types but does not attempt conversion between them, i.e., \tcode{5} is held strictly as an \tcode{int} and is not implicitly convertible either to \tcode{"5"} or to \tcode{5.0}. This indifference to interpretation but awareness of type effectively allows safe, generic containers of single values, with no scope for surprises from ambiguous conversions. \end{note} @@ -7352,7 +7352,7 @@ \pnum \begin{note} -This function should be the inverse of \tcode{pointer_to}. +This function is intended to be the inverse of \tcode{pointer_to}. If defined, it customizes the behavior of the non-member function \tcode{to_address}\iref{pointer.conversion}. @@ -7442,10 +7442,10 @@ \pnum \begin{note} -It is expected that calls to \tcode{declare_reachable(p)} will consume +It is expected that calls to \tcode{declare_reachable(p)} consume a small amount of memory in addition to that occupied by the referenced object until the -matching call to \tcode{undeclare_reachable(p)} is encountered. Long running programs -should arrange that calls are matched. +matching call to \tcode{undeclare_reachable(p)} is encountered. +Thus, long-running programs where calls are not matched can exhibit a memory leak. \end{note} \end{itemdescr} @@ -7463,7 +7463,7 @@ live until the corresponding \tcode{undeclare_no_pointers()} call. \begin{note} In a garbage-collecting implementation, the fact that a region in an object is -registered with \tcode{declare_no_pointers()} should not prevent the object from +registered with \tcode{declare_no_pointers()} does not prevent the object from being collected. \end{note} @@ -7475,7 +7475,7 @@ it points to was created by global \tcode{operator new} and not previously declared reachable. \begin{note} -This may be used to inform a +This can be used to inform a garbage collector or leak detector that this region of memory need not be traced. \end{note} @@ -7486,8 +7486,8 @@ \pnum \begin{note} -Under some conditions implementations may need to allocate memory. -However, the request can be ignored if memory allocation fails. +The request can be ignored +if a memory allocation needed by the implementation fails. \end{note} \end{itemdescr} @@ -7605,7 +7605,7 @@ \begin{note} The alignment assumption on an object \tcode{X} expressed by a call to \tcode{assume_aligned} -may result in generation of more efficient code. +might result in generation of more efficient code. It is up to the program to ensure that the assumption actually holds. The call does not cause the compiler to verify or enforce this. An implementation might only make the assumption @@ -8371,11 +8371,7 @@ derived, at the expense of providing far fewer garbage collection and leak detection options for \tcode{malloc()}-allocated objects. It also allows \tcode{malloc()} to be implemented with a separate allocation arena, bypassing -the normal \tcode{declare_reachable()} implementation. The above functions -should never intentionally be used as a replacement for -\tcode{declare_reachable()}, and newly written code is strongly encouraged to -treat memory allocated with these functions as though it were allocated with -\tcode{operator new}. +the normal \tcode{declare_reachable()} implementation. \end{note} \pnum @@ -9059,7 +9055,7 @@ \tcode{get_deleter()(old_p)}. \begin{note} The order of these operations is significant -because the call to \tcode{get_deleter()} may destroy \tcode{*this}. +because the call to \tcode{get_deleter()} might destroy \tcode{*this}. \end{note} \pnum @@ -9769,7 +9765,7 @@ The template parameter \tcode{T} of \tcode{shared_ptr} may be an incomplete type. \begin{note} -\tcode{T} may be a function type. +\tcode{T} can be a function type. \end{note} \pnum @@ -9949,9 +9945,9 @@ \pnum \begin{note} -To avoid the possibility of a dangling pointer, the -user of this constructor should ensure that \tcode{p} remains valid at -least until the ownership group of \tcode{r} is destroyed. +Use of this constructor leads to a dangling pointer +unless \tcode{p} remains valid +at least until the ownership group of \tcode{r} is destroyed. \end{note} \pnum @@ -10106,7 +10102,7 @@ \begin{note} The use count updates caused by the temporary object construction and destruction are not observable side -effects, so the implementation may meet the effects (and the +effects, so the implementation can meet the effects (and the implied guarantees) via different means, without creating a temporary. In particular, in the example: \begin{codeblock} @@ -10115,7 +10111,7 @@ p = p; q = p; \end{codeblock} -both assignments may be no-ops. +both assignments can be no-ops. \end{note} \end{itemdescr} @@ -10325,8 +10321,8 @@ \pnum \begin{note} When multiple threads -can affect the return value of \tcode{use_count()}, -the result should be treated as approximate. +might affect the return value of \tcode{use_count()}, +the result is approximate. In particular, \tcode{use_count() == 1} does not imply that accesses through a previously destroyed \tcode{shared_ptr} have in any sense completed. \end{note} @@ -15164,12 +15160,13 @@ a specialization of \tcode{reference_wrapper} or a function pointer. Otherwise, may throw \tcode{bad_alloc} or any exception thrown by the copy constructor of the stored callable object. -\begin{note} + +\pnum +\recommended Implementations should avoid the use of dynamically allocated memory for small callable objects, for example, where \tcode{f}'s target is an object holding only a pointer or reference to an object and a member function pointer. -\end{note} \end{itemdescr} \indexlibraryctor{function}% @@ -15186,12 +15183,11 @@ \tcode{f} is in a valid state with an unspecified value. \pnum -\begin{note} +\recommended Implementations should avoid the use of dynamically allocated memory for small callable objects, for example, where \tcode{f}'s target is an object holding only a pointer or reference to an object and a member function pointer. -\end{note} \end{itemdescr} \indexlibraryctor{function}% @@ -15222,12 +15218,6 @@ \pnum Otherwise, \tcode{*this} targets a copy of \tcode{f} initialized with \tcode{std::move(f)}. -\begin{note} -Implementations should avoid the use of -dynamically allocated memory for small callable objects, for example, -where \tcode{f} is an object holding only a pointer or -reference to an object and a member function pointer. -\end{note} \pnum \throws @@ -15235,6 +15225,13 @@ a specialization of \tcode{reference_wrapper} or a function pointer. Otherwise, may throw \tcode{bad_alloc} or any exception thrown by \tcode{F}'s copy or move constructor. + +\pnum +\recommended +Implementations should avoid the use of +dynamically allocated memory for small callable objects, for example, +where \tcode{f} is an object holding only a pointer or +reference to an object and a member function pointer. \end{itemdescr} @@ -18559,9 +18556,9 @@ \end{codeblock} \end{example} \begin{note} -Because different parallel architectures may require idiosyncratic +Because different parallel architectures might require idiosyncratic parameters for efficient execution, implementations -may provide additional execution policies to those described in this +can provide additional execution policies to those described in this standard as extensions. \end{note} diff --git a/tools/check.sh b/tools/check.sh index b6beddb6c6..1f4d623bc6 100755 --- a/tools/check.sh +++ b/tools/check.sh @@ -82,12 +82,12 @@ grep -n "&[ 0-9a-z_]\+) = delete" $texfiles && exit 1 # Bad characters in label. "-" is allowed due to a single remaining offender. grep -n '^\\rSec.\[[^]]*[^-a-z.0-9][^]]*\]{' $texfiles | sed 's/$/ <--- bad character in label/' | grep . && exit 1 -# "shall" inside a note +# "shall", "may", or "should" inside a note for f in $texfiles; do - sed -n '/begin{note}/,/end{note}/{/shall[^a-zA-Z]/{=;p}}' $f | + sed -n '/begin{note}/,/end{note}/{/\(shall\|may\|should\)[^a-zA-Z]/{=;p}}' $f | # prefix output with filename and line sed '/^[0-9]\+$/{N;s/\n/:/}' | sed "s/.*/$f:&/" | - sed 's/$/ <--- "shall" inside a note/' + sed 's/$/ <--- "shall", "should", or "may" inside a note/' done | grep . && exit 1 # Hanging paragraphs