VCC supports equality for arbitrary structured types, accessible via the generic functions deep_eq(s1,s2) and shallow_eq(s1,s2). Both functions expect values that shall be compared.

For structs, shallow equality will only compare the values of all primitive fields and pointers (reference equality, not deep equality) that are not part of a nested struct, union, (or group). Deep equality will also inspected nested structs or groups, but will still use reference equality on pointers.

Two unions are considered equal when they have the same active option and if the field corresponding to their current active option are equal (deep or shallow depending on the equality applied for the union).

In the current version, maps are also compared by reference, but this will change as soon as we have a general solution for map equality.

Also, currently equality for structs that contain finite arrays is not supported. There are triggering problems with the corresponding universally quantified expressions. This will change once the pass-by-value mechanism for structs has been changed.

Last edited Nov 13, 2009 at 12:03 PM by stobies, version 4


No comments yet.