Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
gusttedt
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
3 ms
·
1.
▲
by
gusttedt
6y ago
In the current proposal, the whole function body can act as a guarded block. So for simple cleanup strategies that are bound to functions, you wouldn't need this.
2.
▲
by
gusttedt
6y ago
No, actually none of that. That code has a constraint violation: it uses the variable i outside of its scope. Even if i would be declared on the same level as the guard, this sequence of deferred statements would not do good, but also not m
3.
▲
by
gusttedt
6y ago
That is effectively one of the options that is under discussion. One of the advantage of the approach with defer is really that everything happens in the open and all uses that one would want to classify as misuse can easily be flagged by t
4.
▲
by
gusttedt
6y ago
IIRC in C++ this is only so if there is a try/catch underneath.
5.
▲
by
gusttedt
6y ago
In the contrary, I find it really weird to bind all cleanup code to some kind of object with constructors and destructors. People seem to have gotten so used to this ... I think that for C it is much more natural to have a control structure
6.
▲
by
gusttedt
6y ago
Just use the reference implementation that is linked in the post. We would much appreciate feedback from users at this point.