Function arguments

To aid creating scripts for ASCET-DEVELOPER class code unit testing, it is common to let each class have a single method which reads all inputs to the class. This method is called a ReadInputs method. This method has the benefit of generating a single line of source which clearly hooks into test scripts.

A disadvantage of the ReadInputs method is that the resulting code function has a non-optimal call. It is more efficient to pass a pointer to a structure rather than multiple arguments.

Each instance of each class has an internal static variable for each argument. It is possible to remove the ReadInputs method, and instruct ASCET-DEVELOPER to make copies of required data, To do this, select the Set option on the variables that are being read, as shown in the following screenshot:

Code optimization-Function arguments screenshot

Similarly, multiple output variables can be handled by selecting the Get option on the output variables.

The resulting C code replaces the ReadInputs function with structure-to-structure element copies which should be more efficient. This is because the structure base addresses need to be loaded only once.

Previous Next