Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 940 Bytes

File metadata and controls

18 lines (11 loc) · 940 Bytes

Iec018 - Structure fields should be pointers

Suggestion Suggestion

Checks fields with the attributes [Output], [Input], [InOut], [InputPort] or [OutputPort] when the field type is a struct that was declared with [Structure] or [Array] attribute. If the struct type is large, it should be a pointer type with the [InOut] attribute to improve the performance.

The field is reported if:

  • it is not a pointer type
  • or it does not have the [InOut] attribute

Solution

Evaluate whether the structure type is large and the performance advantage is enough to use unsafe code.

You can also use the provided automatic Code Fix to change the type to pointer and change the attribute to [InOut]. ( Press Alt + Enter on the Error line to find the Code Fix in the context menu)

Change the type to be a pointer and change the attribute to [InOut]. Don't forget to refactor the references.