News for hackers. Stuff that matters.
Re:As a system programming language, C still deserves learni... by kazinator on Monday July 01, 2019 @11:14AM (#20326132)
Had integers wrapped in a class, yes.

> that overflow is as severe as memory bug in C/C++

In practice, it isn't. In many traditional compilers it has predictable behavior (two's complement wrapping), if we're not talking about floating-point overflow.

Some programs explicitly rely on it. Compiler support can be provided for those programs.

It's simply not in the same category as memory corruption bugs.

Of course, ISO C and C++ have just one category for undefined! However, note that "undefined behavior" is a formal term which extends over beneficial areas such as documented extensions and the use of third-party libraries and headers.

Re:As a system programming language, C still deserves learni... by bsder on Monday July 01, 2019 @08:04PM (#20330935)
> Had integers wrapped in a class, yes.

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.

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.