Comment Comment by faho First of all: Your code is missing braces around the `if` blocks - the `goto out` would be run unconditionally.But anyway, the case for `goto` here is that it jumps immediately to the cleanup that needs to happen always.If you put something between the loop and that, `break` would jump before that and also execute that.Yes, this is a workaround for C's lack of automatic cleanup (RAII, garbage collection, python's `with` or whatever). parent faho 4 years ago
But anyway, the case for `goto` here is that it jumps immediately to the cleanup that needs to happen always.
If you put something between the loop and that, `break` would jump before that and also execute that.
Yes, this is a workaround for C's lack of automatic cleanup (RAII, garbage collection, python's `with` or whatever).