Casting modes
Method of casting data types for variables
Model Configuration Pane: Code Generation / Code Style
Description
Specify how the code generator casts data types for variables.
Settings
Nominal
(default) | Standards Compliant
| Explicit
Default: Nominal
- Nominal
Generate code that uses default C compiler data type casting. This setting removes unnecessary typecasts which might lead to warnings on compilers that expect explicit casts.
- Standards Compliant
Generate code where data type casting complies with MISRA™ standards.
Setting Casting modes to
Standards Compliant
can replace bitwise XOR operations with relational operations in the generated code to satisfy the MISRA C:12 Rule 10.1 when the operands are signed types.- Explicit
Generate code that casts data type values explicitly.
Examples
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No impact |
Safety precaution | No impact |
Programmatic Use
Parameter: CastingMode |
Type: character vector |
Value: 'Nominal' | 'Standards' | 'Explicit' |
Default: 'Nominal' |
Version History
Introduced in R2014b