3 ms·
IMHO it would still be a useful feature, just one that is not strictly needed. You are not able to to pass around such structs, but neither is that possible wit
by meinersbur 2y ago
IMHO it would still be a useful feature, just one that is not strictly needed. You are not able to to pass around such structs, but neither is that possible with the suggested `defer` statement. The only advantage of `defer` is that the destructor code is inline, rather than in a separate destructor function.
But you could gain reusability of headers to be also used in C++, not needing to reinvent the wheel with new issues (e.g. variable lifetime), and a whole lot of existing experience with RAII.