CLEAN Subject, ...
The Clean command is used to initialize variables and structure fields that might contain uninitialized memory. Usually this happens when memory is allocated without clearing it. It is used in conjunction with the Drain command to manage resources; primarially memory. Resource management is a low level activity so Clean and Drain commands are not used in applications. Instead they should be contained within a Class to manage any associated memory.
Arguments on a Clean command list variables to clean according to their type. That is, initial values designated on a variable declaration are applied.
Variables and structure fields with primitive integer and real types are set according to their declarations. When no initial value is declared they are initialized to zero. If an initial value is declared as a question mark then they are left uninitialized. In this case they remain dirty. You might want to leave values uninitialized to improve performance, particularly when processing large arrays.
String variables and fields do not need any specific memory management. By default their initial value is empty. If an initial value is declared they are set to that value. Strings are dynamicly allocated by the run time system and can never be in an uninitialized (dirty) state. An error will be issued if you use a question mark for an initial String value.
Variables with an enumerated type have the same initialization rules as numerics. They are set to their declared initial value or zero if no value is declared. They will be left uninitialized when their initial value is declared as a question mark.
Each field in a structure is cleaned. Fields that are stuctures have each of their sub-fields cleaned recusively.
Every element in an array is cleaned and set to the same value. If you just want to clean an individual element code the subscript for the element as well.
Pointers are treated similarly to numerics. They are set to their declared initial value or zero if no value is declared. Their initial value can only be a 16 bit constant (e.g. @1). They will be left uninitialized when their initial value is declared as a question mark.