Re: Problems w/ goto

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 20, 2010 at 4:47 PM, David Harkness
<david.h@xxxxxxxxxxxxxxxxx> wrote:
> On Fri, Dec 17, 2010 at 10:05 AM, larry@xxxxxxxxxxxxxxxx <
> larry@xxxxxxxxxxxxxxxx> wrote:
>
>> What PHP has implemented is "named break statements", as I understand it.
>>
>
> Not exactly. You can jump to arbitrary (labeled) lines within the same
> context (method/function), but you cannot enter loop constructs--only exit
> them. While the last bit implies they are only "named break statements," you
> can use them outside of loops as a normal goto statement.
>
>    firingSequence:
>        if (!acquireTarget())
>            goto done;
>        fireMainCannon();
>        fireMissiles();
>        if (enemiesInView()):
>            goto firingSequence;
>    done:
>
> The above implements a convoluted do...while loop using goto. Recommended?

Is the problem with using the goto convolutedness(as I've seen other
senior programmers in other languages when explaining, or 'showing
off'), or is their an actual functional problem with it? Is it just
the 'sphagetti code' aspect that it can lead to, meaning confusing
another programmer? Not to hijack from the op, or dilute the
conversation any further than I did over the weekend.

> Certainly not!
>
> David
>



-- 
They're installing the breathalyzer on my email account next week.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux