News for hackers. Stuff that matters.
Re:A Usable C++ Dialect That Is Safe Against Memory Corruption by Kenji on Thursday March 15, 2018 @02:44PM (#16595465)
This is basically how I program C++. Except that I try to avoid the 'new' keyword too by std::make_unique and std::make_shared. This way there are literally zero 'new' and 'delete' or 'malloc' or 'free' calls in your program.
Re:A Usable C++ Dialect That Is Safe Against Memory Corruption by beached_whale on Thursday March 15, 2018 @03:25PM (#16595813)
I would try to go further and wrap them in a class to hide the heap usage and expose the valid uses in the interface. Then it reads like a value and walks like one too. Unless I need virtual inheritance I guess.
Re:A Usable C++ Dialect That Is Safe Against Memory Corruption by ape4 on Thursday March 15, 2018 @03:09PM (#16595672)
Likewise, I avoid -> if possible.
Re:A Usable C++ Dialect That Is Safe Against Memory Corruption by saagarjha on Thursday March 15, 2018 @03:19PM (#16595750)
Like, the operator ->? Why, and what do you use instead?
Re:A Usable C++ Dialect That Is Safe Against Memory Corruption by kolpa on Thursday March 15, 2018 @03:46PM (#16595983)
You could use ".get()." instead of "->", but I don't see how that helps.
Re:A Usable C++ Dialect That Is Safe Against Memory Corruption by fjsolwmv on Thursday March 15, 2018 @06:49PM (#16597155)
Correction: "(foo)." or smart pointer (foo.get())." instead of "foo->".

But I still don't see how that would help.

Re:A Usable C++ Dialect That Is Safe Against Memory Corruption by ZephyrP on Thursday March 15, 2018 @05:29PM (#16596672)
Well I guess you're safe against UAF! (har har)