Remove local variable initialization to zero value
Control generation of initialization code for local variables set to zero
Since R2023b
Model Configuration Pane: Code Generation / Optimization
Description
The Remove local variable initialization to zero value parameter
specifies whether to generate initialization code for local variables set to zero. Clear this
parameter to generate code that complies with coding standards such as MISRA C++:2008 Rule 0-1-4
(Polyspace Bug Finder).
Settings
on
(default) | off
- On
Does not generate initialization code for local variables set to zero.
- Off
Generates initialization code for local variables set to zero.
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | 'on' |
Safety precaution | No recommendation |
Programmatic Use
Parameter:
RemoveLocalVariableInitialization
|
Type: character vector |
Values:
'on' | 'off' |
Default:
'on' |
Limitations
If you clear this parameter, the code generator does not generate zero initializations for local variables that have these types:
struct
typesTypes that contain
struct
types_m128
Types that contain a C++ class, such as
std::string
Types that have symbolic dimensions
If you clear this parameter, the code generator does not generate zero initializations for local variables that have a continuous state.
If you clear this parameter, the MAT-file logging parameter does not reflect zero initializations of local variables.
Version History
Introduced in R2023b