| ▲ | Joker_vD 11 hours ago | |||||||
From what I can see in the codegen, defer is not implemented "properly": the deferred statements are only executed when the block exits normally; leaving the block via "return", "break", "continue" (including their labelled variants! those interact subtly with outer defers), or "goto" skips them entirely. Which, arguably, should not happen:
would not close file if it was empty. In fact, I am not sure how it works even for normal "return 0": it looks like the deferred statements are emitted after the "return", textually, so they only properly work in void-returning function and internal blocks. | ||||||||
| ▲ | ricardobeat 10 hours ago | parent [-] | |||||||
Did you manage to compile this example? | ||||||||
| ||||||||