safecpp#

Safecpp Library
status: draft
security: YES
safety: ASIL_B
tags: baselibs_safecpp

Abstract#

SafeCPP is a collection of utilities that helps developers write safer C++ code.

Motivation and Rationale#

The C++ standard library targets general-purpose software and often lacks the stricter semantics needed in safety-critical code. SafeCPP fills these gaps with small, opt-in utilities that make failure modes explicit and are easy to adopt incrementally.

Following components are provided by SafeCPP:

  • aborts_upon_exception: Globally replaces C++ exception handling with std::abort() calls for safety compliance.

  • coverage_termination_handler: Ensures coverage data is preserved in GoogleTest death tests.

  • safe_atomics: Prevents overflow when adding numbers to atomic variables (thread-safe addition with TryAtomicAdd).

  • safe_math: Provides overflow-safe arithmetic operations for integral and floating-point types.

  • scoped_function: Offers controlled callable execution with explicit lifetime guarantees.

  • string_view: Provides null-terminated string view types and safety utilities for secure string handling.