top | item 46383088

(no title)

feelamee | 2 months ago

> sometimes that’s actually what you meant — you’re calling it only for its side effect. Back in 2022, Stephan T. Lavavej estimated of unique_ptr::release that “90% of discards are a bug, but 10% are maybe valid…

What are these 10% valid cases? Does someone have an example

discuss

order

quuxplusone|2 months ago

Here's a made-up example, not from any particular codebase:

try { f(p.get()); (void)p.release(); } catch (...) { /* f threw; don't release p after all */ }