2 ms·
> I think lambda capture initializers with C++14 help in this regard so that unique_ptr can be used. They're still opt-in—the burden is on the programmer to ge
by pcwalton 11y ago
> I think lambda capture initializers with C++14 help in this regard so that unique_ptr can be used.
They're still opt-in—the burden is on the programmer to get it right.
> In addition, the memory safety tooling is improving - see Herb Sutter's CppCon 2015 keynote.
Sure. But it's not here yet, it requires a lot of annotations, and there are several key unanswered questions that I didn't see an answer to (how the static analysis deals with pointers derived from shared_ptr when it relies on all pointer function parameters being unaliased, for example).
> Finally, C++17 should have co-routines which will make this type of callback code less used and allow one to use "normal" logic without callbacks that will also be non-blocking.
And when the coroutines suspend/yield, you have the exact same issues regarding dangling pointers and use-after-free.