chromium / subspace

A concept-centered standard library for C++20, enabling safer and more reliable products and a more modern feel for C++ code.; Also home of Subdoc the code-documentation generator.
https://suslib.cc
Apache License 2.0
89 stars 15 forks source link

Compile-time option for overflow checks #408

Closed danakj closed 10 months ago

danakj commented 10 months ago

This is necessary to reduce the risk of adopting safe numerics, you can always remove the overhead and still keep type safety with no truncation or sign changes, and well-defined overflow. This matches the option available in Rust as well.

This also aligns with the "arithmetic safety" profile suggested by Dr Stroustrup in "Delivering Safe C++": https://www.youtube.com/watch?v=I8UvQKvOSSw