Re-use of Code
Section 6 Program Code Issues
90
3BSE042835-600
It is possible to address sub function block parameters using dot notation. This can
be used in order to save memory and execution time. One way to use the dot
notation is for access of Out parameters. See the example in
, where the
variable x can be omitted by using dot notation. It is not possible to use dot notation
for parameters with By_ref attribute.
Figure 30. Example of dot notation for access of Out parameters.
Since the parameter value is stored in the function block, there is no need to assign
all parameters in every function block call. See the example in
where both
memory and execution time is saved by the use of dot notation. Another variant of
this solution can be used when the same function block is called several times. The
fact that parameter values from the last call are stored can be used and not all
parameters needs to be assigned in each call. However, this solution should be used
with care, because one has to keep track of which values that actually are used.
Figure 31. Example of conditional assignment of parameter using dot notation.
If the input parameter default value is satisfactory, the copying becomes
unnecessary. It is therefore worthwhile to choose default values with care.
To connect a string literal to a function block, declare a variable of type
String[]
of
correct length (if no value is specified, the string length defaults to 40 characters)
with the attribute “Constant”.
Содержание AC 800M
Страница 1: ...Power and productivity for a better worldTM AC 800M Library Object Style Guide System Version 6 0...
Страница 2: ......
Страница 3: ...AC 800M Library Object Style Guide System Version 6 0...
Страница 12: ...Related Documentation About This User Manual 12 3BSE042835 600...
Страница 18: ...Naming Convention Section 1 Libraries 18 3BSE042835 600...
Страница 108: ...SIL Mark Restrictions Section 6 Program Code Issues 108 3BSE042835 600...
Страница 116: ...Standard Library Parameters Appendix A Names and Abbreviations 116 3BSE042835 600...
Страница 119: ......