News for hackers. Stuff that matters.
Re:A static_cast is not always just a pointer adjustment by Animats on Saturday April 02, 2016 @03:47PM (#11413043)
Trying to fix this with the type system doesn't really work. Tracking the changing attributes along a path of control flow with the type system requires an insanely complicated type system.

Rust's borrow checker understands invalidation via move, and lots of other changes in variable state which occur along execution paths. That seems the way to go. But it has to be integrated into the language design. As a backwards compatible bolt-on to C++, it just won't work.

(It's been tried. I tried once, about 10 years ago, and gave up. I talked to the designers of Rust, and they tried and gave up. There have been other attempts to get C++ ownership under compile time checking, and the result is either a new incompatible C++ variant or something that leaks like a sieve. Ownership needs to be a fundamental language concept independent of type)

Re:A static_cast is not always just a pointer adjustment by catnaroek on Saturday April 02, 2016 @06:57PM (#11413967)
I didn't mean to suggest this can be done with C++'s existing type system.
Re:A static_cast is not always just a pointer adjustment by steveklabnik on Saturday April 02, 2016 @04:27PM (#11413248)
Have you seen the Core Gudelines and the GSL? Not as powerful as Rust, but very interesting.
Re:A static_cast is not always just a pointer adjustment by catnaroek on Saturday April 02, 2016 @04:42PM (#11413327)
The C++ Core Guidelines aren't always mechanically enforceable. Experience shows that unenforceable rules will be broken. After all, what's undefined behavior, if not an unenforceable “don't do this” rule?
Re:A static_cast is not always just a pointer adjustment by steveklabnik on Saturday April 02, 2016 @07:30PM (#11414097)
Also, they don't deal with concurrency currently, either.