Initialization of arrays#

Initialization of Arrays

Description#

If all elements of an array are identical, the initialization shall be done like this: value ^size Note: An initialization such as ‘ ‘, ‘ ‘, ‘ ‘, etc. leads to more memory usage than ‘ ‘ ^n.

Rationale#

This rule ensures that arrays are always initialized with maximum efficiency.

Initializing arrays with a [value, value, ...] notation with all-similar values generates larger model files than using a value^N notation. On very large arrays, this may lengthen project load times in the SCADE IDE.

Enforcing a value^N notation ensures model file size and loading times are optimized.

Verification#

This rule registers to predefined data array initialization expressions. It raises a violation when an array is initialized with a [value, value, ...] notation that uses the same value for each item.

Resolution#

Modify the offending array initialization to use a value^N notation.

Customization#

N/A.