You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make precondition checks consistent across debug and release (#29)
The library guarded out-of-bounds and size-mismatch operations with assert,
which the standard disables when NDEBUG is defined. As a result the checks
fired (aborting) in debug but vanished in release, turning operator[] and
replace_range_at into silent undefined behavior / buffer overflows there.
Introduce FCPP_PRECONDITION in compatibility.h: an always-on check that
evaluates its condition and calls std::abort() on failure in every build,
preserving the library's existing fatal error model. Replace the assert /
"assert(false); std::abort();" precondition checks in vector, set and map
with it. Define FCPP_NO_PRECONDITION_CHECKS to compile the checks out for
hot paths whose inputs are already validated.
Debug and release now behave identically; all existing EXPECT_DEATH tests
pass under both build types. Added a death test for map's const operator[]
with a missing key, which previously had no coverage.
0 commit comments