Opened 18 years ago

Closed 17 years ago

#289 closed Bugs (None)

xtime_cmp: use comparison not subtraction

Reported by: phhodges Owned by: glassfordm
Milestone: Component: timer
Version: None Severity:
Keywords: Cc:

Description

Subtraction of integral types is prone to arithmetic
overflow.
It is not well-behaved for implementing comparison unless
we first cast both operands to a wider integral type or
assert that they fall in a narrower range.

Choose comparison order to slightly favour future timeouts,
or imminent timeouts in the same second?

Patch provided "as is" without express or implied warranty.
It may contain any number of intended and unintended flaws.

Change History (1)

comment:1 by martin_wille, 17 years ago

Status: assignedclosed
Logged In: YES 
user_id=592361

This was fixed in version 1.14 (2004-08-09) of xtime.hpp
(Boost 1.32.0 and better).


Note: See TracTickets for help on using tickets.