Main Content

hisl_0063: Length of user-defined object names to improve MISRA C:2012 compliance

ID: Titlehisl_0063: Length of user-defined object names to improve MISRA C:2012 compliance
Description

To improve MISRA C:2012 compliance of generated code, use configuration parameter Maximum identifier length (MaxIdLength) to limit the length of user defined names.

Note

The default of Maximum identifier length is 31.

AFor Subsystem blocks with parameter Function name options set to User specified, limit the length of function names to be equal to or less than the value specified in Maximum identifier length.
B

Limit the length of data object names to be equal to or less than the value specified in Maximum identifier length:

  • Simulink.AliasType

  • Simulink.NumericType

  • Simulink.VariantExpression

  • Simulink.Bus

  • Simulink.BusElement

  • Simulink.IntEnumType

C

When using these storage classes, limit the length of signal and parameter names to be equal to or less than the value specified in Maximum identifier length:

  • Exported Global

  • Imported Extern

  • Imported Extern Pointer

  • Custom storage class

Note

If specified, this includes the length of the Identifier name.

NoteWhen using a Service Interface configuration, identifiers derived from expansion tokens (e.g., $R, $X, etc.) can exceed the maximum identifier length.
RationaleLength in the generated code can result in a MISRAC:2012 violation.
Model Advisor ChecksCheck for length of user-defined object names (Simulink Check)
References
  • ISO 26262-6, Table 6 (1d) – No multiple use of variable names

  • DO-331, Section MB.6.3.2.e – ‘Low-level requirements conform to standards’

    DO-331, MB.6.3.3.e 'Software architecture conforms to standards’

  • MISRA C:2012, Rule 5.1

    MISRA C:2012, Rule 5.2

    MISRA C:2012, Rule 5.3

    MISRA C:2012, Rule 5.4

    MISRA C:2012, Rule 5.5

Prerequisiteshisl_0060: Configuration parameters that improve MISRA C:2012 compliance
Last ChangedR2023b
Examples

You can limit the function name to the length equal to or less than the specified value using Code mappings. This can be used to avoid violation of MISRA rules.