Speaking as a non skilled beginning programmer with a Basic language background and some time with '51 and PIC assembler...
Personally a Goto is a bone left over from the dark ages of C programming... When K&R were the new guys on the block This was I feel a sop to the languages that did support such nonsense and I feel strongly that justifying the use of obfuscating code that easily generates more, similar code is just that or a clever method of emphasizing the true value of Goto... Why not the two examples presented. Although I don't pretend to even "Yet" understand the Template 'method' or the other fine example which is as comprehensible as as the Template class?, I've written many lines of basic code starting with GW basic (Gee Whiz... It Works?") and both Goto and Gosub are hacks on good coding structure... I use "Globals" only when the code requires that global access to system variables mainly time or other accumulated data is required for proper evaluation of code continuity... In every other case after 20 years of writing working but CRAP code... I am personally very happy that the prevalent methodology frowns on starting spaghetti code practices... This I had to discover myself by rewriting previously written code to include new functions... It's like writing functions in 8051 assembler with multiple entry, exit points... a simple change lines later can make the code all but unusable unless the entry/exit holes are filled... This was the way I had to learn 51 assembler... We had a "Programmer" to write some controller code for an irrigation clock and he insisted that his code was perfect and that the '51 cores were the best hardware available... even though it took 12 clock cycles to accomplish.
My feelings are that If a programmer not real proficient at his vocation is hired to write code and requires what are unnecessary jumps (Goto) to code that doesn't have a fixed return path to begin with he isn't competent... just an opportunist hack... the hardest thing I do is to try to layout a flow chart or a state diagram before I begin to write the title block. This is an Expert method to create unplanned code... coders that write good code by "the seat of their pants" are experts with an intimate knowledge of the intricacies of the chosen language... The rest are merely accidents looking for a place to happen.
There is purpose to structure and the Goto is the antithesis of good structured programming..
For the record I am a 67 year old hardware engineer learning a most complex language... From two points...
One is the dearth of specific books for embedded coding and the second one is the time I must spend to learn C/C++ code practices that I'll never use because I only develop embedded projects...
Leaving out the differences between C99 and C11 as they refer to the 'Unusual Arduino Dialect' embedded controller paradigm and the parts dumbed down so junior can learn bad coding practices... Strings are a no brainer... Garbage collection in 2K of sram is an unattainable joke... Even if an allocatesd scratchpad approach is applied to a memory area reserved properly for that kind of foolishness it will fail... sooner or later.
I appreciate that I am making a large statement about an area of which I am still very much not qualified to speak to..
Goto's are like mildew in code, once started they are difficult to eradicate and frequently reasons for many failures... If only because of the lack of an exception handler to deal with the unintended consequences of going out of C and into the rough...
...
Doc