Autore: dvalin Data: To: dng Oggetto: Re: [DNG] C exception handling
On 02.11.24 13:59, Didier Kryn wrote:
> Le 02/11/2024 à 00:39, Bob Proulx via Dng a écrit : > > I have always > > considered goto to be a keyword of the damned but this causes me to > > stop and think and consider that maybe I have been too harsh when it > > is used appropriately. > > There has been many critics about goto, up to the point to recommend > never using it. It was obviously due to widespread abuse. I have seen some > bad programmers horribly abuse of GOTO in FORTRAN. Some people then > recommended even to forbid its usage. But it is like everything, to use > moderately, when apropriate. A simple goto may avoid a horrible nesting of > loops.
ITUT SDL (Specification & Description Language), much used for
telecommunications and protocol stack design and implementation includes
a JOIN operation. It allows a transition (the sequence of actions
following an input event match at a state) to go to a labelled juncture
in any other transition in the same state machine, rather than go
directly to a new state or return to the scheduler without change of
state. Given its widespread use, due to its great utility, it was
probably wise not to spell JOIN as GOTO, lest the gullible regurgitate
the aversion-therapy dogma used to protect programming novitiates from
themselves.
Where another state already has a transition implementing all the
actions (such as a thorough two-party Call cleardown sequence) which we
need at the state we're coding, it would be reprehensible to create a
duplicate, as that significantly impairs maintainability. The shared
transition cannot be moved to a new state for shared use, without adding
a superfluous event to activate a superfluous transition to reach that
superfluous state. The JOINed transition is a nifty go to for uniform
cleardown from any state, for reliable system performance, with a
maintenance minimum. I.e. very good design, in this circumstance.
But each to his own, I figure.
--
Habit is habit, and not to be flung out of the window by any man, but