Package: glib

Function g-variant-compare

Lambda List

g-variant-compare (value-1 value-2)

Arguments

value-1 -- a basic-typed g-variant instance
value-2 -- a g-variant instance of the same type

Return Value

Negative value if a < b; zero if a = b; positive value if a > b.

Details

Compares value-1 and value-2.

The types of value-1 and value-2 are :pointer only to allow use of this function with GTree, GPtrArray, etc. They must each be a g-variant instance.

Comparison is only defined for basic types (i.e. booleans, numbers, strings). For booleans, false is less than true. Numbers are ordered in the usual way. Strings are in ASCII lexographical order.

It is a programmer error to attempt to compare container values or two values that have types that are not exactly equal. For example, you cannot compare a 32-bit signed integer with a 32-bit unsigned integer. Also note that this function is not particularly well-behaved when it comes to comparison of doubles; in particular, the handling of incomparable values (i.e. NaN) is undefined.

If you only require an equality comparison, the function g-variant-equal is more general.
 

See also

2020-12-1