*Eventually* we will be able to use this pattern:<code>if (auto my_foo = foo_new())<br>{<br> // my_foo is non-nullptr<br> defer {<br> foo_free(my_foo); // At the end of the enclosing scope, my_foo will be freed.<br> }<br>} else {<br> // my_foo is nullptr, handle the error;<br>}<br></code>
This will make for much cleaner code, long-term.