News for hackers. Stuff that matters.
Re:Bounded Integer: Header-only C++ library replaces integer... by klyrs on Sunday September 29, 2019 @04:34PM (#21109458)
> A smart compiler can narrow it down to machine size integers then possible.

A smart compiler will be able to narrow it down in a limited set of scenarios, but all we need to do is put an accumulator into a loop to see that bounding an integer is equivalent to the halting problem. Or for another example, should we expect our "smart" compiler to bound y in the following? The bound on x is a freebie.

  bigint n(uint64_t x) {
    bigint i = 0;
    bigint y = x;
    while (y != 1) {
      i++;
      if (y%2) y = y//2;
      else y = 3*y-1; 
    }
    return i;
  }
Re:Bounded Integer: Header-only C++ library replaces integer... by vzaliva on Sunday October 06, 2019 @12:40PM (#21173083)
As I said, "when possible". When not possible a smart compiler can give a warning or an error and ask the user to either use arbirary-precision integer or a type with bound checking.
Re:Bounded Integer: Header-only C++ library replaces integer... by klyrs on Sunday September 29, 2019 @08:45PM (#21110783)
tfw you notice typos after the edit window closes :'(