Skip to content

Commit 60e8aa7

Browse files
committed
LWG4044 Confusing requirements for std::print on POSIX platforms
[ostream.formatted.print] New paragraphs not numbered as indicated since they are part of the \effects clause.
1 parent 0cc6ae5 commit 60e8aa7

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

source/iostreams.tex

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6854,25 +6854,31 @@
68546854
without regard to the value of \tcode{os.exceptions()} and
68556855
without turning on \tcode{ios_base::badbit} in the error state of \tcode{os}.
68566856
\end{itemize}
6857+
6858+
\par % This paragraph is part of the \effects clause.
68576859
After constructing a \tcode{sentry} object,
68586860
the function initializes a variable with automatic storage duration via
68596861
\begin{codeblock}
68606862
string out = vformat(os.getloc(), fmt, args);
68616863
\end{codeblock}
6864+
\begin{itemize}
6865+
\item
68626866
If the function is \tcode{vprint_unicode} and
6863-
\tcode{os} is a stream that refers to a terminal capable of displaying Unicode
6867+
\tcode{os} is a stream that refers to a terminal that
6868+
is only capable of displaying Unicode via a native Unicode API,
68646869
which is determined in an implementation-defined manner,
6870+
flushes \tcode{os} and then
68656871
writes \tcode{out} to the terminal using the native Unicode API;
68666872
if \tcode{out} contains invalid code units,
68676873
\indextext{undefined}%
6868-
the behavior is undefined and
6869-
implementations are encouraged to diagnose it.
6870-
If the native Unicode API is used,
6871-
the function flushes \tcode{os} before writing \tcode{out}.
6872-
Otherwise (if \tcode{os} is not such a stream or
6873-
the function is \tcode{vprint_nonunicode}),
6874+
the behavior is undefined.
6875+
\item
6876+
Otherwise
68746877
inserts the character sequence
68756878
\range{out.begin()}{out.end()} into \tcode{os}.
6879+
\end{itemize}
6880+
6881+
\par % This paragraph is part of the \effects clause.
68766882
If writing to the terminal or inserting into \tcode{os} fails,
68776883
calls \tcode{os.setstate(ios_base::badbit)}
68786884
(which may throw \tcode{ios_base::failure}).
@@ -7837,28 +7843,27 @@
78377843
Let \tcode{out} denote the character representation of
78387844
formatting arguments provided by \tcode{args}
78397845
formatted according to specifications given in \tcode{fmt}.
7840-
If \tcode{stream} refers to a terminal capable of displaying Unicode,
7846+
\begin{itemize}
7847+
\item
7848+
If \tcode{stream} refers to a terminal that
7849+
is only capable of displaying Unicode via a native Unicode API,
7850+
flushes \tcode{stream} and then
78417851
writes \tcode{out} to the terminal using the native Unicode API;
78427852
if \tcode{out} contains invalid code units,
78437853
\indextext{undefined}%
7844-
the behavior is undefined and
7845-
implementations are encouraged to diagnose it.
7854+
the behavior is undefined.
7855+
\item
78467856
Otherwise writes \tcode{out} to \tcode{stream} unchanged.
7847-
If the native Unicode API is used,
7848-
the function flushes \tcode{stream} before writing \tcode{out}.
7857+
\end{itemize}
78497858
Unconditionally unlocks \tcode{stream} on function exit.
78507859

78517860
\xrefc{7.21.2}.
78527861

78537862
\begin{note}
7854-
On POSIX and Windows, \tcode{stream} referring to a terminal means that,
7855-
respectively,
7856-
\tcode{isatty(fileno(\linebreak{}stream))} and
7863+
On Windows the native Unicode API is \tcode{WriteConsoleW} and
7864+
\tcode{stream} referring to a terminal means that
78577865
\tcode{GetConsoleMode(_get_osfhandle(_fileno(stream)), ...)}
7858-
return nonzero.
7859-
\end{note}
7860-
\begin{note}
7861-
On Windows, the native Unicode API is \tcode{WriteConsoleW}.
7866+
returns nonzero.
78627867
\end{note}
78637868

78647869
\pnum

0 commit comments

Comments
 (0)