Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Goto-labels for exception handling?

by zentara (Archbishop)
on May 10, 2018 at 13:40 UTC ( [id://1214327]=note: print w/replies, xml ) Need Help??


in reply to Goto-labels for exception handling?

They will have to rip my right to use a goto LABEL statement from my cold dead hands! :-) I prefer a goto when needing to break out of deeply nested loops, although more experienced programmers recommend nesting while loops instead of a goto. However, I think the goto is very intuitive and easy to understand in a flow chart situation, and should be used for clarity.

I guess the real issue is way down in the C-compiler and ultimately the underlying assembly language. Which is more efficient in number of computer operations, energy usage, etc. Nesting complicated loops, or using a simple GOTO LABEL.

I watched a youtube video of an assemby expert, who dissected compiled C-code programs, and rewrote them more efficiently in assembly, discarding alot of c-code library bloatware. He could change a 20k sized c-utility to one in pure assembly of only 2k, and it ran way faster. I would leave to smarter programmers than I, to devise a test which timed the goto usage, vs. nested loops method. See Reusable threads demo for the origin of this challenge of mine. :-)

  • Comment on Re: Goto-labels for exception handling?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1214327]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-26 07:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found