C and gotos are common from what I've seen -- userspace and kernel C code deals with error handling and resource freeing easier that way.
Open to see examples of (good) C code that doesn't use it though.
Open to see examples of (good) C code that doesn't use it though.
if(something_bad)
{
err = BADTHING1;
goto oops;
}
// more stuff
return 0;
oops:
return err;
I'll add1. keep code that performs calculations separate from code that performs side effects. In fact isolate the latter as much as possible.
2. Avoid spooky action at a distance. Code should relentlessly work towards a clear goal.