[TUHS] I can't drive 55: "GOTO considered harmful" 55th anniversary

segaloco via TUHS tuhs at tuhs.org
Fri Mar 10 10:54:48 AEST 2023


I guess I hadn't considered deeply nested loops. I contort myself into a mental pretzel figuring out how to avoid GOTOs sometimes, maybe I could stand to embrace one every once in a while myself...

Now doing some research, more languages support GOTO than I thought, including C#, PHP, even Rust for all its safety orientation appears to at least muster a GOTO-ish construct. If people keep doing it, it must still be wanted, needed, and useful. I stand corrected on my never-GOTO attitude. Now to slip a GOTO into a work project and see how long it takes to get chastised :)

- Matt G.
------- Original Message -------
On Thursday, March 9th, 2023 at 3:54 PM, Warner Losh <imp at bsdimp.com> wrote:

> Oh also sometimes for breaking out of multiple levels of while/for loops. The alternatives are often worse.
>
> Warner
>
> On Thu, Mar 9, 2023, 4:31 PM Luther Johnson <luther at makerlisp.com> wrote:
>
>> I agree, unless I use setjmp/longjmp for that. Besides error recovery, there are occasionally other times when we want to locally "return" to a common state and start "from the top" again. I find such uses very clear in their intent, and if commented well, not hard to follow at all - as long as there is not more than one "top" :)
>>
>> On 03/09/2023 04:21 PM, Warner Losh wrote:
>>
>>> On Thu, Mar 9, 2023, 4:18 PM segaloco via TUHS <tuhs at tuhs.org> wrote:
>>>
>>>> GOTO is one of those paradoxical things where I would only trust the most sophisticated engineer to know when it's acceptable to use a GOTO but on the flip side would be suspicious of anyone claiming to be an engineer that uses any amount of GOTOs...
>>>>
>>>> Were any of the various GOTOs in languages ever meant to be any more than providing the same level of control that branch statements in assembly do? Was there ever some vision anyone's aware of concerning a sophisticated, dependable use of GOTOs? Since my first days poking around learning C GOTO has been mentally filed away as an assembly vestige for folks in transition, not a dependable construct in its own right. Any alternative camps out there?
>>>
>>> In C I use it all the time to do goto err for common error recovery because C doesn't have anything better.
>>>
>>> Warner
>>>
>>>> - Matt G.
>>>>
>>>> ------- Original Message -------
>>>> On Thursday, March 9th, 2023 at 3:01 PM, Steffen Nurpmeso <steffen at sdaoden.eu> wrote:
>>>>
>>>>> I wonder if Pink Floyd's Summer68 maybe refers to this.
>>>>> Other than that i am addicted and could not live without it.
>>>>> The other (terrible) song is from 1984 (east southern US).
>>>>>
>>>>> --steffen
>>>>> |
>>>>> |Der Kragenbaer, The moon bear,
>>>>> |der holt sich munter he cheerfully and one by one
>>>>> |einen nach dem anderen runter wa.ks himself off
>>>>> |(By Robert Gernhardt)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.tuhs.org/pipermail/tuhs/attachments/20230310/e862bebc/attachment.htm>


More information about the TUHS mailing list