主要内容

hisf_0065: Type cast operations in Stateflow to improve code compliance

R2026b

Protect against Stateflow implicit data type casting for integer and fixed-point calculations to data types other than input data types

Usage: High-Integrity System Modeling

Guideline ID: hisf_0065

Prerequisite: hisl_0060: Configuration parameters that improve MISRA C compliance

Rules

hisf_0065: Type cast operations in Stateflow® to improve code compliance

In Stateflow charts that use the C action language, use the := notation to protect against Stateflow implicit data type casting for integer and fixed-point calculations to data types other than input data types.

Rationale

To avoid implicit casts in the generated code that might violate coding standards.

Verification

Check assignment operations in Stateflow Charts (Simulink Check)

Tips

  • If you follow this and other modeling guidelines, you increase the likelihood of generating code that complies with the coding standards.

Industry Standards

  • DO-331 Section MB.6.3.2.b 'Low-level requirements are accurate and consistent'

  • IEC 61508–3, Table A.3 (2) Strongly typed programming language

  • IEC 61508–3, Table A.4 (3) Defensive programming

  • IEC 62304, 5.5.3 - Software Unit acceptance criteria

  • ISO 26262-6, Table 1 (1b) Use of language subsets

  • ISO 26262-6, Table 1 (1c) Enforcement of strong typing

  • ISO 26262-6, Table 1 (1d) Use of defensive implementation techniques

  • ISO 26262-6, Table 6 (1g) - 'No implicit type conversions'

  • EN 50128, Table A.4 (8) Strongly Typed Programming Language

  • EN 50128, Table A.3 (1) Defensive Programming

  • EN 50657, Table A.4 (8) Strongly Typed Programming Language

  • EN 50657, Table A.3 (1) Defensive Programming

  • EN 50716, Table A.3 (1) Defensive Programming

  • MISRA C:2012, Rule 10.1

  • MISRA C:2023, Rule 10.1

  • MISRA C:2012, Rule 12.2

  • MISRA C:2023, Rule 12.2

Version History

Introduced in R2011a

expand all