"Andrey Hristov" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jan Dittmer wrote: > > Andrey Hristov wrote: > > > >> Robert Cummings wrote: > >> > >>> > >>> > >>> Unmaintainable because of the ability to write cryptic code. There's > >>> nothing cryptic about: > >>> > >>> ...code > >>> > >>> goto cleanup: > >>> > >>> ...code > >>> > >>> cleanup: > >> > >> > >> do { > >> .....code... > >> if (something) break; > >> ...code.... > >> } while (0); > >> ...cleanup code... > >> > > > > This works for one level, but imagine: > > > > ... code ... (which exits with goto_out) > > > > if (!alloc x) > > goto out; > > > > ... code ... (which exits with goto_outfreex) > > > > if (!alloc y) > > goto out_freex; > > > > ... code ... (which exits with goto_outfreey) > > > > if (!alloc z) > > goto out_freey; > > > > ... code ... > > > > free z; > > out_freey: > > free y; > > out_freex: > > free x; > > out: > > print bye; > > > > For this you'll need 3 nested do{}while(); loops and your indention is > > so far to the right, that you can barely write more than two more words > > on a line. > > This really looks a lot cleaner with goto. >
The way I would do it is to nest it in multiple layers of try/catch try { try { //code }catch(goto_outfreez) { //process //rethrow exception } } catch (goto_outfreey) { //process //rethrow exception } This would look better if I could write this code in an IDE w/ auto-indenting instead of Outlook Express. In terms of visual appearance, you may be right. I'm used to Java now, so I would currently be more accustomed to seeing multiple indentation layers (which is why I'm getting a widescreen notebook soon). -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php