Re: GOTO operator
| From: | Jan Dittmer | Date: | Fri, 30 Jul 2004 06:16:02 +0000 |
| Subject: | Re: GOTO operator | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-11650@lists.php.net to get a copy of this message | ||
Andrey Hristov wrote:
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Robert Cummings wrote: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. JanUnmaintainable because of the ability to write cryptic code. There's nothing cryptic about:do { .....code... if (something) break; ...code.... } while (0); ...cleanup code......codegoto cleanup:...codecleanup:
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc