I
Ian Collins
I guess RAII removes the need for goto in the original code, eitherVictor said:I learned structured programming a very long time ago (remember
when it was THE way?) Anyway, we were taught to write
int func() {
int ret = 0;
/* do something */
if (!error_condition) {
/* do something else */
if (!error_condition) {
/* some more code */
ret = 1;
}
/* free some memory or whatever */
}
/* free some more memory */
return ret;
}
IIRC structured programming was nicknamed "programming without
the goto".
using exceptions or early return.