Main Content

Use memset to initialize floats and doubles to 0.0

Control generation of code that explicitly initializes floating-point data to 0.0

Model Configuration Pane: Code Generation / Optimization

Description

The Use memset to initialize floats and doubles to 0.0 parameter specifies whether to generate code that explicitly initializes floating-point data to 0.0.

Settings

On (GUI), 'off' (command line) (default) | off (GUI), 'on' (command line)
On

Uses memset to clear internal storage for floating-point data to integer bit pattern 0 (all bits 0), regardless of type. If your compiler and target CPU both represent floating-point zero with the integer bit pattern 0, use this parameter to gain execution and ROM efficiency.

This parameter requires that you turn on the configuration parameter Memcpy threshold to enable the memset functionality. Check that the value of the threshold is set high enough.

Off

Generates code to explicitly initialize storage for data of types float and double to 0.0. The resulting code is slightly less efficient than code generated when you select the option.

Note

The command-line values are reverse of the settings values. Therefore, 'on' in the command line corresponds to the description of “Off” in the settings section, and 'off' in the command line corresponds to the description of “On” in the settings section.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyOn (GUI), 'off' (command line) (execution, ROM), No impact (RAM)
Safety precautionNo impact

Programmatic Use

Parameter: InitFltsAndDblsToZero
Type: character vector
Value: 'on' | 'off'
Default: 'off'

Version History

Introduced before R2006a