主要内容

hisl_0102: Data type of loop control variables to improve MISRA C compliance

R2026b

Use integer data type for loop control counter variables

Usage: High-Integrity System Modeling

Guideline ID: hisl_0102

Rules

hisl_0102: Data type of loop control variables to improve MISRA C compliance

To improve MISRA C:2012 and MISRA C:2023 compliance of generated code, use integer data type for variables that are used as loop control counter variables in:

  • For loops constructed in Stateflow® and MATLAB®.

  • For Iterator blocks.

Rationale

Improve MISRA C:2012 and MISRA C:2023 compliance of the generated code.

Verification

Check data type of loop control variables (Simulink Check)

Industry Standards

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

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

  • MISRA C:2012, Rule 14.1

  • MISRA C:2023, Rule 14.1

Version History

Introduced in R2012a

expand all