I can work without goto for a long time, until suddenly I need it,
usually when coding some kind of error logic. Then I'll have to either
duplicate code or scoot a section into its own subroutine for no other
reason than the lack of a goto. But yeah, it can be confusing later if
used when not necessary. Maybe I should put a piggy bank on my desk and
force myself to put $20 in each time I use it.
On 9/25/2022 4:51 AM, David Crayford wrote:
Another thing that makes me incredibly dubious about some of the
opinions in these videos is the hackneyed nonsense about "goto
considered harmful". The original paper was misunderstood in that all
goto statements are harmful and brainwashed a generation. Some of these
videos present a trivial example using goto and refactor it using
if/ifelse. In programming languages without scope based cleanup goto is
not harmful. In fact it's leads to clean code as the branch direction is
always descending to a cleanup block. Happily for me, the young guys I
work with writing systems level Metal/C code haven't been seduced by
this dogmatic BS. Good C code uses goto statements as opposed to
heavily nested or superfluously functionally decomposed routines. The
IBM Openj9 JVM C code is a case in point
https://github.com/eclipse-openj9/openj9/blob/master/runtime/vm/classsupport.c.
I challenge anybody to write better code without goto statements.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN