News for hackers. Stuff that matters.
Re:How expensive is integer-overflow trapping in C++? by jandrewrogers on Thursday September 24, 2020 @07:49AM (#24577663)
People have written C++ libraries for integer type generation that allow you to specify many properties including various types of arithmetic and runtime behavior. It is pretty transparent to the programmer and efficient.

However, there is real complexity, in terms of library implementation, in figuring out how this zoo of exotic integer types interact with each other consistently and correctly. Doubly so if you want the safety of these interactions to be verified at compile-time to the extent possible.

Re:How expensive is integer-overflow trapping in C++? by amelius on Thursday September 24, 2020 @08:42AM (#24578042)
I think you also want to use the hardware capabilities of the target platform (overflow detection, automatic trapping) as much as possible and at the same time also allow all other integer arithmetic optimizations. Not sure if all of this can be done from within a user library.
Re:How expensive is integer-overflow trapping in C++? by heavenlyblue on Thursday September 24, 2020 @09:38AM (#24578487)
> in figuring out how this zoo of exotic integer types interact with each other consistently and correctly

You just allow to copy them from one to another and allow other operations to only be done on the same types of integers.