News for hackers. Stuff that matters.
Re:A Usable C++ Dialect That Is Safe Against Memory Corruption by kllrnohj on Thursday March 15, 2018 @05:21PM (#16596626)
int get_value(int* pointer) { return *pointer; }

How is a compiler supposed to reject this for undefined behavior? It'd be absurd to demand the compiler someone knows all possible usages for get_value to find if any of them pass a nullptr, so what is it supposed to do?

And this is why the spec says things like that deref'ing a null pointer is undefined behavior, so that the compiler can take that function and do the thing you'd expect it to do and transform it into a simple memory read.

Re:A Usable C++ Dialect That Is Safe Against Memory Corruption by fjsolwmv on Thursday March 15, 2018 @06:43PM (#16597111)
The compiler shouldn't rejected UB, it should define all behavior, and reject all code constructs that can't have behavior fully defined (like accessing raw pointers as arrays, so bounds- checking is impossible). It can throw an exception on null de-reference at runtime. That's slow, but safe.
Re:A Usable C++ Dialect That Is Safe Against Memory Corruption by adrianN on Friday March 16, 2018 @01:47AM (#16598893)
Slow but safe is not why people choose C++ for their software.
Re:A Usable C++ Dialect That Is Safe Against Memory Corruption by wruza on Friday March 16, 2018 @05:14AM (#16599468)
There is a compiler option for that, just run javac alias instead of g++