Re: Goto Jail, go directly to jail.
> If (err == 0) goto retry;
Yes 0 does mean ‘no error’. This is an errno-like status code; errno does not define a symbol for ‘OK’ and using raw 0 or an implicit boolean conversion ( if (!err) ... ) is standard.
The logic is something like this:
1. Try to do something.
2. If it worked, all finished. Stop now.
3. Do some other special action that should help resolve why step 1 didn’t work.
4. If step 3 works, go back to step 1 to retry the original thing.
‘if (err==0) goto retry;’ is saying my step 3 completed with no error, so it can go back to step 1 to retry the original thing.
“Goto considered evil” would suggest that it should be a while loop, ‘until no error’. But there are other schools of thought.