True. That's why I would have written it like this:Rein Halbersma wrote:On a related note, detecting overflow from +INF is hard enough but detecting overflow from INT_MAX is even harder. For Apple users who have been bitten by the Undefined Behavior demons, here's a blog post about Apple's newly released Secure Coding Guide.
Code: Select all
Value rbeta = std::min(beta, VALUE_INFINITE - 200) + 200;