Skip to content

P1147R1 Printing volatile Pointers #5017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions source/iostreams.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5854,6 +5854,7 @@
basic_ostream& operator<<(long double f);

basic_ostream& operator<<(const void* p);
basic_ostream& operator<<(const volatile void* p);
basic_ostream& operator<<(nullptr_t);
basic_ostream& operator<<(basic_streambuf<char_type, traits>* sb);

Expand Down Expand Up @@ -6419,6 +6420,17 @@
\tcode{*this}.
\end{itemdescr}

\indexlibrarymember{operator<<}{basic_ostream}%
\begin{itemdecl}
basic_ostream& operator<<(const volatile void* p);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we use "val" instead of "p" and combine this with the previous itemdecl, similar to how the non-volitile "val" version was?

Copy link
Member Author

Choose a reason for hiding this comment

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

We can't combine with the previous \itemdecl, because the \itemdescr is totally different.
"val" is used for the other overloads because these are "arithmetic inserters", but I do believe since we have a separate \itemdecl, we might as well use the more idiomatic "p" for a pointer value.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit awkward that the current const void* overload uses p in the header synopsis but val in the description, but regardless, using p in both places for the new overload seems good.

\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
Equivalent to: \tcode{return operator<<(const_cast<const void*>(p));}
\end{itemdescr}

\rSec4[ostream.inserters]{\tcode{basic_ostream::operator<<}}

\indexlibrarymember{operator<<}{basic_ostream}%
Expand Down