← Back to Pull requests

Fix the incorrect comment about `std::print` #6482

Closed
unknown closed this pull request without merging on Oct 29, 2026 07:20 UTC
View on GitHub
unknown unknown commented on Oct 09, 2026 15:29 UTC
Author

The current comment is outrageously wrong to me. My patch is based on my testing on Windows 11 FP 26H1 (Build 28120). Although I haven't tested it on older versions, I was very surprised by the current comment, because it doesn't match my cognize of Windows.

I used the following test method to test whether the return value of _fileno could be -2:

1. Create a console app and use the following code:

#pragma comment(linker, "/SUBSYSTEM:WINDOWS")

#include <print>

int wWinMain(void*, void*, void*, int)
{
	std::print("Hello, World!");
}

2. Set a breakpoint at if (_Fd == -2) (print.cpp L25).
3. Execute the program and observe the value of _Fd.

I observed that _Fd was -2.

I used the following steps to test the behavior of Console Allocation Policy:

1. Create a console app and use the following code:

#include <print>
#include <windows.h>
#pragma comment(linker, "/manifestinput:\"console_policy.manifest\"")
int main()
{
	MessageBox(NULL, L"Press OK to continue.", L"Message", MB_OK);
	std::print("Hello, World!");
}

2. Create console_policy.manifest:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <application>
    <windowsSettings>
      <consoleAllocationPolicy xmlns="http://schemas.microsoft.com/SMI/2024/WindowsSettings">detached</consoleAllocationPolicy>
    </windowsSettings>
  </application>
</assembly>

4. Set a breakpoint at if (_Fd == -2).
5. Use Explorer to execute ConsoleApplication1.exe.
6. Use VS to attach to the process.
7. Click "OK"
8. Observe the value of _Fd.

I observed that _Fd was -2.

I used the following steps to test the behavior of redirecting std output to NUL:

1. Create a console app and use the following code:

#include <print>
#include <thread>
#include <windows.h>

int main()
{
	MessageBox(NULL, L"Press OK to continue.", L"Message", MB_OK);
	std::print("Hello, World!");
}

2. Set a breakpoint at if (_Fd == -2).
3. Use CMD to execute ConsoleApplication1.exe > NUL.
4. Use VS to attach to the process.
5. Click "OK"
6. Observe the value of _Fd.

I observed that _Fd was 1 (stdout).

Diff: 293 lines (+219 / -74) across 3 files Reviewer: YexuanXiao Review duration: 28311m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 293 lines diff across 3 files
0.40
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.340
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6482"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.9% (MEDIUM) · Higher = larger blast radius
39.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.8% · Safe to merge
15.8%
Repository