I'ved used goto in C to handle cleanup of dynamically allocated resources.
BOOL some_func() { BOOL success = FALSE; allocate_temp_resources(); if (might_fail()) { goto Cleanup; } if (might_fail()) { goto Cleanup; } success = TRUE; Cleanup: free_temp_resources(); return success; }
Suiteable alternatives can be written in C++ and Perl thanks to destructors.
In reply to Re^2: Breakin' the rules, Breakin' the rules
by ikegami
in thread Breakin' the rules, Breakin' the rules
by esk555
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |