[TUHS] Conditions, AKA exceptions. (Was: I can't drive 55: "GOTO considered harmful" 55th anniversary)

Ralph Corderoy ralph at inputplus.co.uk
Fri Mar 10 21:51:45 AEST 2023


Hi Noel,

> > In C I use it all the time to do goto err for common error recovery
> > because C doesn't have anything better.
>
> That's because C doesn't have 'conditions'. (Apparently, from the following
> posts, most people here are unfamiliar with them. Too bad, they are a great
> idea. OK summary here:
>
>   http://gunkies.org/wiki/Condition_handler

I wasn't familiar with the term ‘condition handler’.  That page starts

   ‘A condition handler (sometimes exception handler) refers to a
    mechanism in some programming languages which allows the programmer
    to provide code to handle the occurrence of a exception or condition
    (terminology varies, but the substance does not).’

Oh, exceptions.  I know what they are and if you say above that most
people are unfamiliar with them due to their use of goto then that's
probably wrong.

There are good reasons languages like Go chose not to include them.
https://go.dev/doc/faq#exceptions

-- 
Cheers, Ralph.


More information about the TUHS mailing list