2 ms·
It's a lot more than that. You can have a use after free by taking a const reference to a stack allocated value and returning it. You can happily have buffer o
by UncleMeat 3y ago
It's a lot more than that.
You can have a use after free by taking a const reference to a stack allocated value and returning it. You can happily have buffer overruns on data structures like std::vector. You can have use after frees through misuse of smart pointers. You can have all sorts of fun problems through invalid casts.
The rules to actually subset c++ in a way that is safe by construction are actually way more harsh than commonly presented and Bjarne's proposal is, in my opinion, nowhere near strong enough to actually achieve it.