Re: GOTO operator
| From: | Andrey Hristov | Date: | Fri, 30 Jul 2004 00:54:34 +0000 |
| Subject: | Re: GOTO operator | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-11638@lists.php.net to get a copy of this message | ||
Sara Golemon wrote:
" Advanced C users may be familiar with a different usage of the do..while loop, to allow stopping execution in the middle of code blocks, by encapsulating them with do..while (0), and using the break statement. The following code fragment demonstrates this:" (a similar code follows) " Don't worry if you don't understand this right away or at all. You can code scripts and even powerful scripts without using this 'feature'. " (the manual states that people can code powerful things without goto hack). Sara, if you need to have the goto, you know how to implement it with do..while. The average Joe may not need goto in some case but he will find that it simplifies his job (but making code clumsy, something what he does not realize). It is not because I don't like the power of goto, I would like not to be given in the hands of the newbie. andreydo { .....code... if (something) break; ...code.... } while (0); ...cleanup code...Are you suggesting a hack is better than the real thing? -Sara The "hack" is working. The manual says :