Name n3760, alx-0071r1 - add _Assert(), not depending on NDEBUG Principles - Codify existing practice to address evident deficiencies. Category Library Author Alejandro Colomar History r0 (2025-11-26): - Initial draft. r1 (2025-12-01; n3760): - Add 'Prior art'. Description assert(3) depends on NDEBUG. This results in unreliable behavior. Many projects define their own reliable assert(3)- like macro to replace it. Others are careful to #undef NDEBUG before including . Let's make it easy for everyone, by providing a reliable version, _Assert(). Prior art The Linux kernel is an example of a well-known project that defines such a macro (with the names assert() and ASSERT()). It uses panic() and other internals instead of abort(3), but the effects are essentially the same. Proposed wording Based on N3550. 7.2.1 Diagnostics :: General @@ p1 The header defines the +_Assert, -assert +assert, and __STDC_VERSION_ASSERT_H__ macros and refers to another macro, ... @@ p2 The -assert macro +<_Assert and assert macros shall be implemented -as a macro with an ellipsis parameter, +as macros with an ellipsis parameter, -not as an actual function. +not as actual functions. If the macro definition is suppressed to access an actual function, the behavior is undefined. 7.2.2.1 The assert macro @@ Title -The assert macro +The _Assert macro @@ Synopsis, p1 #include - void assert(scalar expression); + void _Assert(scalar expression); @@ Description, p2 ## s/assert/_Assert/g @@ Returns, p3 ## s/assert/_Assert/g 7.2.2 Program diagnostics @@ New subsection after 7.2.2.1 +7.2.2.1+1 The assert macro + +Synopsis +1 + #include + void assert(scalar expression); + +Description +2 + If NDEBUG is not defined (see 7.2.1), + assert is equivalent to _Assert.