Copyright (C) 2000-2012 |
GNU Info (g-wrap.info)Function for object comparisonsFunction for object comparisons =============================== The function for checking the equality of two objects should have a declaration like int EQUAL_FN_NAME(TYPE* OBJ1, TYPE* OBJ2); It should return 0 for false (not equal), and 1 for true (equal). Here is an example from the matrix object type: int MAT_equal(MAT *m1, MAT *m2) { int i, j; if ( !m1 || !m2 ) { return ( m1 == m2 ); } if ( ! (m1->m == m2->m && m1->n == m2->n) ) { return 0; } for ( i = 0; i < m1->m; i++ ) { for ( j = 0; j < m1->n; j++ ) { if ( m1->me[i][j] != m2->me[i][j] ) { return 0; } } } return 1; } automatically generated by info2www version 1.2.2.9 |