Re:As a system programming language, C still deserves learni...
by kazinator on Tuesday July 02, 2019 @01:15AM
(#20332329)
That was practically a poster example to sell C++. Look, you can overload operators and get arrays with bounds checking, integers that trap overflows and so on.
Twenty years ago, C++ was still hot and there was a lot of interest in all sorts of techniques. Books, seminars, papers, blogs, you name it.
There is a way to use C++ template partial specialization to mimic the built-in conversion rules, like "int op long" promoting the left operan to "int". You can mirror the language in itself and bend the rules.
Okay, you were serious about safety. Congratulations, you are the first one I have ever come across.
I have never seen anyone else wrap integers in a class in order to use them with stable semantics.