P4008R0 — Clean Modular Mode: Legacy Opt-out for C++
(7 items)
EWG
This paper proposes splitting the C++ standard into three fixed modules (std.core, std.modern, and std.legacy) and introducing an 'exclude std.legacy' syntax that allows per-translation-unit opt-out of legacy C-compatible pitfalls such as array decay, C-style casts, and implicit narrowing conversions. The mechanism is strictly opt-in, preserves full backward compatibility by default, and retains all low-level system programming capabilities in a non-excludable core. The goal is to provide a compiler-enforced clean subset of C++ that enables gradual migration without ABI breaks, dialect fragmentation, or removal of low-level features.
-
Section 8.3, page 6 — std::narrow_cast
(d) is used as a standard library function available via import std.modern, but no such function exists in the C++ standard library; narrow_cast exists only in the GSL as gsl::narrow_cast and is unchecked (a static_cast wrapper), not a checked conversion. [1] - Section 4, page 3 — Heading promises '3 Bullet Points' but provides only one top-level numbered item ('1.') with three sub-items; items '2.' and '3.' do not exist. [2]
- Section 1, page 2 — Heading '1.One-Sentence Vision' is missing a space after the period, inconsistent with other headings such as '2. Problem We Solve'. [3]
- Section 3, page 3 — Heading '3.Core Axioms (Key Insight)' is missing a space after the period, same inconsistency as Section 1. [4]
References — Anthropic Citations API
[1]
"8.2 Clean Mode (Compile Errors for Pitfalls) 8.3 Modern Safe Equivalent (Clean Mode) exclude std.legacy; // Opt into Clean Mode void clean_code() { int arr[10]; int* p = arr; // ERROR: Array..."
"8.2 Clean Mode (Compile Errors for Pitfalls) 8.3 Modern Safe Equivalent (Clean Mode) exclude std.legacy; // Opt into Clean Mode void clean_code() { int arr[10]; int* p = arr; // ERROR: Array..."
[2]
"4. Proposal (3 Bullet Points) 1. **Split the standard into 3 fixed, non-overlapping modules**:"
"4. Proposal (3 Bullet Points) 1. **Split the standard into 3 fixed, non-overlapping modules**:"
[3]
"================================================== 1.One-Sentence Vision Keep full backward compatibility by default, but allow users to opt out of historical C-compatible baggage via modular..."
"================================================== 1.One-Sentence Vision Keep full backward compatibility by default, but allow users to opt out of historical C-compatible baggage via modular..."
[4]
"================================================== 3.Core Axioms (Key Insight) Low-level capability≠ historical garbage Low-level capability ≠inherently unsafe Low-level capability ≠ to be..."
"================================================== 3.Core Axioms (Key Insight) Low-level capability≠ historical garbage Low-level capability ≠inherently unsafe Low-level capability ≠ to be..."
[4]
"================================================== 3.Core Axioms (Key Insight) Low-level capability≠ historical garbage Low-level capability ≠inherently unsafe Low-level capability ≠ to be..."
"================================================== 3.Core Axioms (Key Insight) Low-level capability≠ historical garbage Low-level capability ≠inherently unsafe Low-level capability ≠ to be..."
Summary: P4008R0 proposes a modular opt-in/opt-out system for C++ legacy features, partitioning the standard library and language semantics into std.core, std.modern, and std.legacy layers so that users can exclude legacy pitfalls at compile time while preserving full backward compatibility by default.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.