MISRA.CATCH.NOALLEllipsis exception handler is not the last one in a try-catch block. MISRA-C++ Rule 15-3-7 (required): Where multiple handlers are provided in a single try-catch statement or function-try-block, any ellipsis (catch-all) handler shall occur last.RationaleIf the catch-all handler is found before any other handler, that behaviour will be performed. Any handlers after the catch-all are unreachable code and can never be executed. Examplevoid f1 ( ) { try { // ... } catch ( int32_t i ) // int handler { // Handle int exceptions } catch( ... ) // catch-all handler { // Handle all other exception types } } void f2 ( ) { try { // ... } catch( ... ) // catch-all handler { // Handle all exception types } catch ( int32_t i ) // Non-compliant — handler will never be called { } } |