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

Steffen Nurpmeso steffen at sdaoden.eu
Mon Mar 13 08:27:38 AEST 2023


Warner Losh wrote in
 <CANCZdfqOZ3wrHktZGk3BrHV5ZdbkDyRPGxH61Mq87TVDQRQh7A at mail.gmail.com>:
 |On Sun, Mar 12, 2023, 2:47 PM Dave Horsfall <dave at horsfall.org> wrote:
 |> On Fri, 10 Mar 2023, Steffen Nurpmeso wrote:
 |>
 |>>|Seriously, I also use setjmp()/longjmp() for a more elegant exit from a
 |>>
 |>> That is sheer unbelievable, really?  _So_ expensive!
 |>
 |> How often would you call setjmp()/longjmp()

Only on a Sunday!

I never used these myself of free will.

(And never regulary at all until i took maintainership of a BSD
Mail clone, which is the examplary piece of software to show that
BSD signal handling and SA_RESTART are a terrible misconception,
especially as soon as the software gets larger. .. In my opinion.
Once it was able to run "24/6" i counted the number of system
calls necessary for signal block / release and installation
/ removal over a week, and i think the number was way in the six
digits.  System calls them all!  I should have taken the OpenBSD
variant instead, and simply take over what "was good", and it
would be much, much better by now.  They did the work and reduced
the very messy part to two exactly locatable system call points of
interest.  (I looked i guess 2014-<2017.)  A very bad decision.
But if i live long enough i will make it, and another one i would
really long for.)

 |Cheap enough for occasional error handling, way too expensive for a generic
 |exception handling system... processors with lots of registers were more of
 |a problem...

Even on a x86(-32) i have gnashed with my teeth.  And that with
a Cyrix from 1996 .. and not to think about i386 or even earlier
processors with so few memory and speed.
I remember _for sure_ looking at the jmpbuf structure by then, and
the assembler files (sheer magic by then) and x86 instructions.

"Some" jpeg library used jump buffers to signal errors.
(I got rid of most sources for things that will never come true,
but i do have libjpeg-turbo ball due to package dependencies, and
they also use that internally, but looking at it it seems to be
a different thing.)
That is maybe ok since image processing is maybe expensive enough
by itself to simply say they do not care about proper error paths
along the way but take a "dead-end exit".  (But it was i think not
like that with the jpeg i have in mind.)

--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)


More information about the TUHS mailing list