P3984R0 — A type-safety profile (16 items) EWG, SG12, SG20, SG23
Bjarne Stroustrup
This paper describes the design and rationale for C++ Profiles, a framework for guaranteeing type safety and resource safety in C++ programs through a subset-of-superset strategy combining static analysis with hardened libraries. It presents detailed specifications for type-safety and resource-safety profiles, covering objects, resources, constructors/destructors, range errors, nullptr access, and dangling pointer invalidation. The paper concludes with a call to action for implementers to adopt the Profiles framework and begin experimenting with specific profiles to gain standardization experience.

References — Anthropic Citations API

[1]
"One limiting factor here will be the lack of a standard internal representation of C++ (e.g., IPR [GDR11, CDR21], Clang AST [MK13])."
[2]
"[BS24] B. Stroustrup: A framework for Profiles development. P3274R0. 2024-05-5. and [BS24] B. Stroustrup: Programming: Principle and Practice using C++. Addison-Wesley. 2024. ISBN 978-0-13-830868-1."
[3]
"[BS24] B. Stroustrup: A framework for Profiles development. P3274R0. and [BS24b] B. Stroustrup: A framework for Profiles development. WG21 P3274R0."
[4]
"[BS23] B. Stroustrup and G. Dos Reis: Safety Profiles: Type-and-resource Safe programming in ISO Standard C++. P2816R0. 2023-02-16 and [BS23a] B. Stroustrup and G. Dos Reis: Safety Profiles:..."
[5]
"• [BS24] B. Stroustrup: Programming: Principle and Practice using C++. Addison-Wesley. 2024. ISBN 978-0-13-830868-1. "
[5]
"• [BS24] B. Stroustrup: Programming: Principle and Practice using C++. "
[6]
"It is impossible to prove an arbitrary program safe for any reasonably definition of "safe" in a language able to manipulate hardware and implement fundamental abstractions."
[7]
"access through a invalidated pointer; that is, a pointer to an object that had been deleted or gone out of scope"
[8]
"By "pointer", we include anything the refers to an object (e.g., references and lambda captures)."
[9]
"However, wraparound of unsigned arithmetic is well-defined so a profile cannot define to be anything else."
[10]
"The two obvious ways of avoiding accessing an object that is not of the right type (or no type at all) is to prevent"
[11]
"If an alias to an object has been taken, don't call a function that can invalidate it use the object."
[12]
"However, not everybody – not even in WG21 – is used to think about this in the context of defining a language feature or a library component."
[13]
"Note that libraries for checking arithmetic exists (e.g., [BS25d, HH25])."
[14]
"Note that libraries for checking arithmetic exists (e.g., [BS25d, HH25]). and [BS25d] B. Stroustrup: Concept-Based Generic Programming in C++. 2025-10."
[15]
"Subsetting is done through static analysis (ideally by the compiler) Subsetting alone cannot deliver many of the most desired guarantees"
[16]
"Copies and moves To be handled similar to constructors and destructors. "
Summary: P3984R0 proposes a type-safety profile for C++ that defines a set of rules and their enforcement mechanisms to guarantee type safety within conforming code regions, covering pointer/reference initialization, range checking, nullptr avoidance, casts, unions, and lifetime management. The paper targets EWG, SG12, SG20, and SG23 for discussion of profiles as a path to safer C++ without language subsetting.
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.