Main Content

Saturate on integer overflow

Integer overflow support

Description

App Configuration Pane: Speed

Configuration Objects: coder.MexCodeConfig | coder.CodeConfig | coder.EmbeddedCodeConfig

Control support for integer overflow in the generated code. This parameter applies only to MATLAB® built-in integer types. It does not apply to doubles, singles, or fixed-point data types.

Settings

On

This setting is the default setting.

The code generator produces code to handle integer overflow. Overflows saturate to either the minimum or maximum value that the data type can represent.

Off

The code generator does not produce code to handle integer overflow. Do use this option unless you are sure that your code does not depend on integer overflow support.

  • If you disable integer overflow support and run-time error checking is enabled, the generated code produces an error for overflows.

  • If you disable integer overflow support and you disable run-time error checking, the overflow behavior depends on your target C compiler. In the C standard, the behavior for integer overflow is undefined. However, most C compilers wrap on overflow.

Programmatic Use

Property: SaturateOnIntegerOverflow
Values: true | false
Default: true

Version History

Introduced in R2011a