Main Content

hisf_0015: Strong data typing (casting variables and parameters in expressions)

R2026b

Explicitly type cast variables and parameters of different data types in expressions

Usage: High-Integrity System Modeling

Guideline ID: hisf_0015

Rules

hisf_0015: Strong data typing (casting variables and parameters in expressions)
A

To facilitate strong data typing, explicitly type cast variables and parameters of different data types in Stateflow®.

Rationale

Apply strong data typing.

Verification

Check Stateflow charts for strong data typing (Simulink Check)

Example — Correct

Explicit type casting is applied to variables and parameters in the expression.

Stateflow chart with transition condition uint16(uint_8_Var) < uint_16_Var between State_A and State_B

Example — Incorrect

No explicit type casting is applied to variables and parameters in the expression.

Stateflow chart with transition condition int_8_Var < int_16_Var between State_A1 and State_B1

Tips

  • The Stateflow software automatically casts variables of different type into the same data type. This guideline helps clarify data types of the intermediate variables.

Industry Standards

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

  • IEC 62304, 5.5.3 - Software Unit acceptance criteria

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

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

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

  • DO-331, Section MB.6.3.2.g 'Algorithms are accurate'

  • MISRA C:2012, Rule 10.1
    MISRA C:2012, Rule 12.2

  • MISRA C:2023, Rule 10.1
    MISRA C:2023, Rule 12.2

Version History

Introduced in R2010a

expand all