Non-Rules and myths
NR.6
Don't place all cleanup actions at the end of a function and `goto exit`
Reason
goto is error-prone. This technique is a pre-exception technique for RAII-like resource and error handling.
Example, bad
void do_something(int n)
{
if (n < 100) goto exit;
// ...
int* p = (int*) malloc(n);
// ...
if (some_error) goto exit;
// ...
exit:
free(p);
}
and spot the bug.