Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
9.4.2 assert(false) in default clause, compliant?
#2
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.
Posted by and on behalf of
the MISRA C++ Working Group
Reply


Messages In This Thread
RE: 9.4.2 assert(false) in default clause, compliant? - by misra cpp - 06-06-2025, 03:06 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)