SA0023: Complex return values

Determines complex return values that cannot be returned with a simple registry copy of the processor. This includes structures, arrays, and return values of type STRING (regardless of the size of the used memory).

Justification: This is a performance warning. If large values are returned as the result of a function, method, or property, then the processor copies them multiple times when executing the code. This can lead to runtime problems and should be avoided whenever possible. Performance can be improved by passing a structured value as VAR_IN_OUT to a function or method and filling it in the function or method.

Importance: Medium

Example

TYPE LargeStructure :
STRUCT
        a : LINT;
        b : BOOL;
END_STRUCT
END_TYPE

FUNCTION Large_Return_Value_FUNC : LargeStructure   // SA0023

--> SA0023: Komplexe Rückgabewerte