Specify whether to generate default cases for switch-case statements in the code for Stateflow® charts. This optimization works on a per-model basis. It applies to the code generated for a state that has multiple substates. For a list of the state functions in the generated code, see Inline State Functions in Generated Code.
Category: Code Generation > Code Style
Default: on
Do not generate the default case when it is unreachable. This setting enables better code coverage because every branch in the generated code is falsifiable.
Generate a default case whether or not it is reachable. This setting supports MISRA C® compliance and provides a backup in case of RAM corruption.
For example, when the state has a nontrivial entry
function,
the following default case appears in the generated code for the during
function:
default: entry_internal(); break;
In this case, the code marks the corresponding substate as active.
Parameter: SuppressUnreachableDefaultCases |
Type: character vector |
Value: 'on' | 'off' |
Default: 'on' |
Application | Setting |
---|---|
Debugging | Noimpact |
Traceability | On |
Efficiency | On (execution, ROM), Noimpact (RAM) |
Safety precaution | No recommendation |