4. Defining Data Types : compare Routine—Compare Two Data Elements
 
Share this page                  
compare Routine—Compare Two Data Elements
This routine compares values of two user-defined data types. If the II_DT_NOSORT attribute is provided in the dtd_attributes field, then the compare routine is not necessary.
The input arguments are II_DATA_VALUE pointers to the two data elements being compared. The data elements must be of the same type. The final argument, result, must be set to be a negative number, 0, or a positive, non-zero number depending on whether the first argument is less than, equal to, or greater than the second argument. That is,
if arg1 < arg2, result is negative
else if arg1 == arg2 result equals 0
else result is non-zero, positive
The address of this routine must be placed in the dtd_compare_addr field of the IIADD_DT_DFN structure.