View source code
Display the source code in std/experimental/checkedint.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Function std.experimental.checkedint.Abort.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), then application is terminated with assert(0)
.
Otherwise, the three-state result is returned (positive if lhs > rhs
,
negative if lhs < rhs
, 0
otherwise).
int hookOpCmp(Lhs, Rhs)
(
Lhs lhs,
Rhs rhs
);
Parameters
Name | Description |
---|---|
lhs | The first argument of Checked , e.g. int if the left-hand side of
the operator is Checked!int |
rhs | The right-hand side type involved in the operator |
Returns
For correct comparisons, returns a positive integer if lhs >
rhs
, a negative integer if lhs < rhs
, 0
if the two are equal. Upon
a mistaken comparison such as int(-1) < uint(0)
, the function never
returns because it aborts the program.
Authors
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.