Methods Without Side Effects
A method that does not change data in the memory is called side-effect-free. If you know that a method is side-effect-free, you can mark it accordingly by activating the Side Effect Free option in the Settings tab of the signature editor.
If Side Effect Free is activated for a method, a code generation error (MMDL96) shall be reported under the following conditions:
- The method contains an assignment (exception: assignment to method-local elements) or a pre/post inc/decrement.
- The method contains a call to a method that is not declared as Side Effect Free.
- The method uses one of the methods provided to change an adaptive characteristic line/map.
- The method has an argument with direction Out or InOut.
The error message is method "<methodName>" declared as side-effect-free, but <reason>, where <reason> is one of the following:
- has write access to non-local "<variableName>"
- has call to none side-effect-free method "<methodName>"
- has call not non-side-effect-free special call
- has in/out or out arguments
A warning shall be reported in the following cases:
The side-effect-free method does not have a return value.
WMdl961: method "<methodName>" is declared as side-effect-free, but has no return value
The return value of the side-effect-free method is not used.
WMdl962: method "<methodName>" is declared as side-effect-free, but return value is not used
See also
Signature Editor – Settings Tab