Method

GLibVariantcompare

since: 2.26

Declaration [src]

gint
g_variant_compare (
  gconstpointer one,
  gconstpointer two
)

Description [src]

Compares one and two.

The types of one and two are #gconstpointer only to allow use of this function with GTree, GPtrArray, etc. They must each be a GVariant.

Comparison is only defined for basic types (ie: 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 (ie: NaN) is undefined.

If you only require an equality comparison, g_variant_equal() is more general.

Available since: 2.26

Parameters

two

Type: GVariant

A GVariant instance of the same type.

Return value

Type: gint

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