Throw.hookOpCmp

Called automatically upon a comparison for ordering using one of the operators <, <=, >, or >=. In case the comparison is erroneous (i.e. it would make a signed negative value appear greater than or equal to an unsigned positive value), throws a Throw.CheckFailure exception. Otherwise, the three-state result is returned (positive if lhs > rhs, negative if lhs < rhs, 0 otherwise).

struct Throw
static
int
hookOpCmp
(
Lhs
Rhs
)
(
Lhs lhs
,
Rhs rhs
)

Parameters

lhs Lhs

The first argument of Checked, e.g. int if the left-hand side of the operator is Checked!int

rhs Rhs

The right-hand side type involved in the operator

Return Value

Type: int

For correct comparisons, returns a positive integer if lhs > rhs, a negative integer if lhs < rhs, 0 if the two are equal.

Throws

Upon a mistaken comparison such as int(-1) < uint(0), the function never returns because it throws a Throw.CheckedFailure exception.

Meta