The OpenD Programming Language

Warn.hookOpEquals

Called automatically upon a comparison for equality. In case of an Erroneous comparison (one that would make a signed negative value appear equal to an unsigned positive value), writes a warning message to stderr as a side effect.

struct Warn
static
bool
hookOpEquals
(
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: bool

In all cases the function returns the built-in result of lhs == rhs.

Examples

auto x = checked!Warn(-42);
// Passes
assert(x == -42);
// Passes but prints a warning
// assert(x == uint(-42));

Meta