vulns.co
/
GKData.io MCP

C++ Core Guidelines project · 1 min read

C++ Core Guidelines: Bounds and Lifetime Safety

The C++ Core Guidelines connect three safety requirements: use objects with valid types, keep memory accesses within bounds, and ensure references do not outlive their objects. The bounds and lifetime sections explain how interface and ownership choices support these requirements, including views that carry size information and avoiding pointers that may no longer be valid.

Open the reference Implementation GuideReviewed 2026-10-12

How to use this reference

During parser design review, document extent, ownership, and validity duration together. Identify where array-to-pointer conversion discards bounds and where views may outlive storage. Use the Pro.bounds, Pro.lifetime, and GSL.view sections to reason about these component-boundary contracts.

Before reading

  • C++ pointers and references
  • Containers and RAII

Context and limits

  • Bjarne Stroustrup and Herb Sutter are credited by the source as editors.
  • These evolving project guidelines are not the normative ISO language standard or an automatic safety guarantee. Their guarantees depend on enforcement and surrounding code.
  • The document distinguishes bounds-checked GSL span from std::span; do not infer that every span implementation checks bounds.

Sources and provenance

  1. C++ Core Guidelines C++ Core Guidelines project · reviewed 2026-10-12

Record reviewed 2026-10-12. Snapshot cb017eaea66e. Open the complete JSON contract.

GitHub snapshot 2026-10-12

cb017eaea66e · JSON exports & schemas · CC BY 4.0 content / MIT software