4 ms·
Thank you. For clarity, here would be the GP example: Foo foo = acquireFoo() defer releaseFoo(foo) if !isValid(foo) { return FAIL } more
by sago 8y ago
Thank you. For clarity, here would be the GP example:
Foo foo = acquireFoo()
defer releaseFoo(foo)
if !isValid(foo) {
return FAIL
}
moreWork(foo)
return SUCCESS
That is impressively clear. I don't use go, myself.
I agree, I am quite comfortable using goto in C/C++ in this context. Though it may be better in C++ to use RAII in this specific example.