[gcc r16-8786] libstdc++: Fix comment on std::print helper __open_terminal

Jonathan Wakely redi@gcc.gnu.org
Tue Apr 21 20:06:42 GMT 2026


https://gcc.gnu.org/g:e2b1c3ea40727db805f8e062dbfff0bb93770004

commit r16-8786-ge2b1c3ea40727db805f8e062dbfff0bb93770004
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Apr 21 21:04:23 2026 +0100

    libstdc++: Fix comment on std::print helper __open_terminal
    
    The comment describes an earlier version of the function which I
    experimented with when implementing the std::print feature. Update it to
    describe the current semantics.
    
    libstdc++-v3/ChangeLog:
    
            * src/c++23/print.cc (__open_terminal): Fix comment.

Diff:
---
 libstdc++-v3/src/c++23/print.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/src/c++23/print.cc b/libstdc++-v3/src/c++23/print.cc
index 290e0b8dfa2d..a12c50bfb6a8 100644
--- a/libstdc++-v3/src/c++23/print.cc
+++ b/libstdc++-v3/src/c++23/print.cc
@@ -75,8 +75,9 @@ namespace
 } // namespace
 #endif
 
-  // This returns intptr_t that is either a Windows HANDLE
-  // or 1 + a POSIX file descriptor. A zero return indicates failure.
+  // Windows: If `f` refers to a console, return the HANDLE associated with it.
+  // POSIX: If `f` refers to a POSIX terminal, return `f`.
+  // Return a null pointer if `f` is not known to be a console or terminal.
   void*
   __open_terminal([[maybe_unused]] FILE* f)
   {
@@ -95,6 +96,7 @@ namespace
     return nullptr;
   }
 
+  // If a `FILE*` can be obtained from `sb`, behave as above.
   void*
   __open_terminal([[maybe_unused]] std::streambuf* sb)
   {


More information about the Libstdc++-cvs mailing list