06-06-2025, 03:06 PM
If asserts are enabled, we'd say yes, using assert as the default behaviour would be acceptable
However, in general, a static analyser cannot determine if asserts are enabled or not. Your example may still be acceptable, as the compiler may warn that not all paths return a value, but in general this is not likely to be the case.
However, in general, a static analyser cannot determine if asserts are enabled or not. Your example may still be acceptable, as the compiler may warn that not all paths return a value, but in general this is not likely to be the case.
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group