Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GOTO bad bad bad

Status
Not open for further replies.
Mar 29, 2004
120
US
I know everyone says that GOTOs are evil, but why? Is it a memory issue? Code inefficiency?

Thank you
 
No, it is because it tends to teach you how to write spaghetti code and make the maintenance and improvements to this code a pure nightmare.

Walid Magd (MCP)

The primary challenge of every software development team is to engineer the illusion of simplicity in the face of essential complexity.
-Grady Booch
 
And it is a "four letter" word as well :)

As Walid stated, GOTO is a major cause of 'spaghetti code" and should be used with extreme caution.
In almost every case, there is a better method available.

HOWEVER, as with all programming techniques, GOTO has uses. Has anybody wondered why every language I am familiar with still supports GOTO?

ANSWER:
Because, there are specific cases where you might need to branch code without returning.

I am playing the devils advocate here. I just want to point out that I know of no programming technique that does not have a use somewhere at some time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top