From a2b2fd21475b0975106be81d9b0fa9a6a3d7d906 Mon Sep 17 00:00:00 2001 From: Daniel Hannon Date: Sun, 14 Jun 2026 16:56:51 +0100 Subject: [PATCH 1/2] P3154R3 Deprecating signed character types in iostreams --- source/future.tex | 92 ++++++++++++++++++++++++++++++++++++++++++++ source/iostreams.tex | 39 ------------------- 2 files changed, 92 insertions(+), 39 deletions(-) diff --git a/source/future.tex b/source/future.tex index 72dbeabbc5..286baf8ca5 100644 --- a/source/future.tex +++ b/source/future.tex @@ -1051,3 +1051,95 @@ \returns \tcode{y}. \end{itemdescr} + +\Sec1[depr.istream.extractors]{Deprecated \tcode{signed char} and \tcode{unsigned char} extraction} +\pnum +The header \libheaderref{istream} has the following additions: + +\begin{itemdecl} +template + basic_istream& operator>>(basic_istream& in, unsigned char& c); +template + basic_istream& operator>>(basic_istream& in, signed char& c); +\end{itemdecl} + +\begin{itemdescr} +\pnum +\effects +Behaves like a formatted input member (as described in\iref{istream.formatted.reqmts}) of \tcode{in}. +A character is extracted from \tcode{in}, if one is available, and stored in \tcode{c}. Otherwise, +\tcode{ios_base::failbit} is set in the input function's local error state before setstate is called. +\pnum +\returns +\tcode{in} +\end{itemdescr} + +\pnum +\begin{itemdecl} +template + basic_istream& operator>>(basic_istream& in, unsigned char (&s)[N]); +template + basic_istream& operator>>(basic_istream& in, signed char (&s)[N]); +\end{itemdecl} + +\begin{itemdescr} +\pnum +\effects +Behaves like a formatted input member (as described in\iref{istream.formatted.reqmts}) of \tcode{in}. +After a sentry object is constructed, \tcode{operator>>} extracts characters and stores them into \tcode{s}. +If \tcode{width()} is greater than zero, \tcode{n} is \tcode{min(size_t(width()), N)}. Otherwise \tcode{n} +is \tcode{N}. \tcode{n} is the maximum number of characters stored. + +\pnum +Characters are extracted and stored until any of the following occurs: +\begin{itemize} +\item \tcode{n - 1} characters are stored; +\item end of file occurs on the input sequence; +\item letting \tcode{ct} be \tcode{use_facet>(in.getloc())}, \tcode{ct.is(ct.space, s)} + is \tcode{true}. +\end{itemize} + +\pnum +\tcode{operator>>} then stores a null byte (\tcode{charT()}) in the next position, which may be the first +position if no characters were extracted. \tcode{operator>>} then calls \tcode{width(0)}. + +\pnum +If the function extracted no characters, \tcode{ios_bit::failbit} is set in the input function's local +error state before \tcode{setstate} is called. + +\pnum +\returns +\tcode{in}. +\end{itemdescr} + +\Sec1[depr.ostream.inserters]{Deprecated \tcode{signed char} and \tcode{unsigned char} insertion} +\pnum +The header \libheaderref{ostream} has the following additions: + +\pnum +\begin{itemdecl} +template + basic_ostream& operator<<(basic_ostream& out, signed char c); +template + basic_ostream& operator<<(basic_ostream& out, unsigned char c); +\end{itemdecl} + +\begin{itemdescr} +\pnum +\effects +Equivalent to: \tcode{return out << static_cast(c);} +\end{itemdescr} + +\pnum +\begin{itemdecl} +template + basic_ostream& operator<<(basic_ostream& out, const signed char* s); +template + basic_ostream& operator<<(basic_ostream& out, const unsigned char* s); +\end{itemdecl} + +\begin{itemdescr} +\pnum +\effects +Equivalent to: \tcode{return out << reinterpret_cast(s);} +\end{itemdescr} diff --git a/source/iostreams.tex b/source/iostreams.tex index 615ea941ed..254a2b731e 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -4387,17 +4387,9 @@ // \ref{istream.extractors}, character extraction templates template basic_istream& operator>>(basic_istream&, charT&); - template - basic_istream& operator>>(basic_istream&, unsigned char&); - template - basic_istream& operator>>(basic_istream&, signed char&); template basic_istream& operator>>(basic_istream&, charT(&)[N]); - template - basic_istream& operator>>(basic_istream&, unsigned char(&)[N]); - template - basic_istream& operator>>(basic_istream&, signed char(&)[N]); } \end{codeblock} @@ -4919,10 +4911,6 @@ \begin{itemdecl} template basic_istream& operator>>(basic_istream& in, charT (&s)[N]); -template - basic_istream& operator>>(basic_istream& in, unsigned char (&s)[N]); -template - basic_istream& operator>>(basic_istream& in, signed char (&s)[N]); \end{itemdecl} \begin{itemdescr} @@ -4976,10 +4964,6 @@ \begin{itemdecl} template basic_istream& operator>>(basic_istream& in, charT& c); -template - basic_istream& operator>>(basic_istream& in, unsigned char& c); -template - basic_istream& operator>>(basic_istream& in, signed char& c); \end{itemdecl} \begin{itemdescr} @@ -6003,11 +5987,6 @@ template basic_ostream& operator<<(basic_ostream&, char); - template - basic_ostream& operator<<(basic_ostream&, signed char); - template - basic_ostream& operator<<(basic_ostream&, unsigned char); - template basic_ostream& operator<<(basic_ostream&, wchar_t) = delete; template @@ -6033,11 +6012,6 @@ template basic_ostream& operator<<(basic_ostream&, const char*); - template - basic_ostream& operator<<(basic_ostream&, const signed char*); - template - basic_ostream& operator<<(basic_ostream&, const unsigned char*); - template basic_ostream& operator<<(basic_ostream&, const wchar_t*) = delete; @@ -6719,11 +6693,6 @@ // specialization template basic_ostream& operator<<(basic_ostream& out, char c); -// signed and unsigned -template - basic_ostream& operator<<(basic_ostream& out, signed char c); -template - basic_ostream& operator<<(basic_ostream& out, unsigned char c); \end{itemdecl} \begin{itemdescr} @@ -6755,11 +6724,6 @@ basic_ostream& operator<<(basic_ostream& out, const char* s); template basic_ostream& operator<<(basic_ostream& out, const char* s); -template - basic_ostream& operator<<(basic_ostream& out, const signed char* s); -template - basic_ostream& operator<<(basic_ostream& out, - const unsigned char* s); \end{itemdecl} \begin{itemdescr} @@ -6791,9 +6755,6 @@ \tcode{basic_ostream\&} and the second is of type \tcode{const char*}, -\item -\tcode{traits::length(reinterpret_cast(s))} -for the other two overloads. \end{itemize} Determines padding for \tcode{seq} as described in~\ref{ostream.formatted.reqmts}. Inserts \tcode{seq} into From 894eac89942935a53dce44e9ceb26134a8ad3502 Mon Sep 17 00:00:00 2001 From: Daniel Hannon Date: Mon, 15 Jun 2026 22:35:17 +0100 Subject: [PATCH 2/2] fixup: deal with overflowing hbox --- source/future.tex | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/source/future.tex b/source/future.tex index 286baf8ca5..985f0d7e38 100644 --- a/source/future.tex +++ b/source/future.tex @@ -1087,8 +1087,8 @@ \effects Behaves like a formatted input member (as described in\iref{istream.formatted.reqmts}) of \tcode{in}. After a sentry object is constructed, \tcode{operator>>} extracts characters and stores them into \tcode{s}. -If \tcode{width()} is greater than zero, \tcode{n} is \tcode{min(size_t(width()), N)}. Otherwise \tcode{n} -is \tcode{N}. \tcode{n} is the maximum number of characters stored. +If \tcode{width()} is greater than zero, \tcode{n} is \tcode{min(size_t(width()), N)}. +Otherwise \tcode{n} is \tcode{N}. \tcode{n} is the maximum number of characters stored. \pnum Characters are extracted and stored until any of the following occurs: @@ -1100,8 +1100,9 @@ \end{itemize} \pnum -\tcode{operator>>} then stores a null byte (\tcode{charT()}) in the next position, which may be the first -position if no characters were extracted. \tcode{operator>>} then calls \tcode{width(0)}. +\tcode{operator>>} then stores a null byte (\tcode{charT()}) in the next position, +which may be the first position if no characters were extracted. +\tcode{operator>>} then calls \tcode{width(0)}. \pnum If the function extracted no characters, \tcode{ios_bit::failbit} is set in the input function's local @@ -1133,9 +1134,11 @@ \pnum \begin{itemdecl} template - basic_ostream& operator<<(basic_ostream& out, const signed char* s); + basic_ostream& + operator<<(basic_ostream& out, const signed char* s); template - basic_ostream& operator<<(basic_ostream& out, const unsigned char* s); + basic_ostream& + operator<<(basic_ostream& out, const unsigned char* s); \end{itemdecl} \begin{itemdescr}