Hacker GitHub

← All repos

dcleblanc/SafeInt

View on GitHub ↗ ★ 252 C++

SafeInt is a class library for C++ that manages integer overflows.

4 mentions on Hacker News by 4 people: 1 story, 3 comments · first 2018-11-14 · latest 2023-11-27

Mentions per year 4 mentions · busiest year 2021 (2)
20082026
  1. …with a #if . [0] https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html , the -ftrapv flag [1] https://github.com/dcleblanc/SafeInt [2] https://www.boost.org/doc/libs/release/libs/safe_numerics/do...
    comment by MaxBarraclough · 2023-11-27 · in C++ needs undefined behavior, but maybe less
  2. …} is not a good type. If you want a "always positive" type use some safe_int template such as https://github.com/dcleblanc/SafeInt - here if you do "x - y" and the result of the computation should be negative, then you'll get the rightful…
    comment by jcelerier · 2021-04-02 · in Summary of C/C++ integer rules
  3. ▲ 8
    SafeInt, a C++ class library to safely manage integer overflows
    story by dgellow · 2021-03-23 · 2 comments
  4. There is, e.g.: https://github.com/dcleblanc/SafeInt But IMO something like this should be a language thing, just so that it's not substantially harder or more verbose to use operators with explicit wraparound or trap.