Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:11650 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93407 invoked by uid 1010); 30 Jul 2004 06:16:22 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 93360 invoked from network); 30 Jul 2004 06:16:21 -0000 Received: from unknown (HELO zoidberg.portrix.net) (212.202.157.208) by pb1.pair.com with SMTP; 30 Jul 2004 06:16:21 -0000 Received: from [192.168.1.34] (c179211.adsl.hansenet.de [213.39.179.211]) (authenticated bits=0) by zoidberg.portrix.net (8.12.3/8.12.3/Debian-6.6) with ESMTP id i6U6GCDo023387 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Fri, 30 Jul 2004 08:16:14 +0200 Message-ID: <4109E7A2.2000701@ppp0.net> Date: Fri, 30 Jul 2004 08:16:02 +0200 User-Agent: Mozilla Thunderbird 0.6 (X11/20040605) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andrey Hristov CC: internals@lists.php.net References: <20040729021337.73894.qmail@pb1.pair.com> <1091136355.490.4.camel@localhost> <1091139076.29517.12.camel@blobule.suds> <410991E1.6070000@hristov.com> <1091140927.29516.18.camel@blobule.suds> <41099925.4020700@hristov.com> In-Reply-To: <41099925.4020700@hristov.com> X-Enigmail-Version: 0.83.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig3861B7E49D3F850549201E41" Subject: Re: [PHP-DEV] GOTO operator From: jdittmer@ppp0.net (Jan Dittmer) --------------enig3861B7E49D3F850549201E41 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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. Jan --------------enig3861B7E49D3F850549201E41 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBCeenLqMJRclVKIYRAheWAJ9wMNrZTOL5zYofZAT2+LMTFGKKQgCcCJb5 a5k8hzXzftLThIaQF/dEiXY= =0WIx -----END PGP SIGNATURE----- --------------enig3861B7E49D3F850549201E41--