Register and join over 40,000 other developers!
Recent Topics
-
The Game You Are Waiting For?
WendellHarper - Dec 06 2020 01:21 PM
-
Quora and Reddit Backlinks
WendellHarper - Dec 06 2020 01:14 PM
-
Delete account
pindo - Jul 23 2020 01:33 AM
-
Print specific values from dictionary with a specific key name
Siten0308 - Jun 20 2019 01:43 PM
-
Learn algorithms and programming concepts
johnnylo - Apr 23 2019 07:49 AM
Recent Blog Entries
Recent Status Updates
Popular Tags
- networking
- Managed C++
- stream
- console
- database
- authentication
- Visual Basic 4 / 5 / 6
- session
- Connection
- asp.net
- import
- syntax
- hardware
- html5
- array
- mysql
- java
- php
- c++
- string
- C#
- html
- loop
- timer
- jquery
- ajax
- javascript
- programming
- android
- css
- assembly
- c
- form
- vb.net
- xml
- linked list
- login
- encryption
- pseudocode
- calculator
- sql
- python
- setup
- help
- game
- combobox
- binary
- hello world
- grid
- innerHTML

Why doesn't anyone use Goto anymore?
Started by Donovan, Sep 09 2009 08:39 AM
21 replies to this topic
#1
Posted 09 September 2009 - 08:39 AM
Why doesn't anyone use a goto statement anymore?
where ever you put goto name; it will go to any section with
name:
So for example.
BLOCK OF CODE HERE
goto name;
BLOCK OF CODE
BLOCK OF CODE
name:
(It would then start at the next block of code after name.)
BLOCK OF CODE
This will work up or down. For example.
mainMenu:
BLOCK OF CODE
BLOCK OF CODE
BLOCK OF CODE
goto mainMenu;
where ever you put goto name; it will go to any section with
name:
So for example.
BLOCK OF CODE HERE
goto name;
BLOCK OF CODE
BLOCK OF CODE
name:
(It would then start at the next block of code after name.)
BLOCK OF CODE
This will work up or down. For example.
mainMenu:
BLOCK OF CODE
BLOCK OF CODE
BLOCK OF CODE
goto mainMenu;

| +Friend Me | My Graphics | Forum Rules | Forum Support | Forum FAQ |
| The CodeCall.net Tutorial's Board |
#2
Posted 09 September 2009 - 10:20 AM
Because other programming structures largely make goto kludgey and irrelevant, relegating "proper" use of goto to very few situations. The ones you show are not them.

#3
Posted 09 September 2009 - 10:27 AM
Goto also can't be used to go into a try statement, making it's practical use in C++ very limited.
Goto is also difficult to read, since there's no way for you to know where that label is short of some kind of very detailed IDE.
I believe there may be uses for Goto... I've just never seen them.
Goto is also difficult to read, since there's no way for you to know where that label is short of some kind of very detailed IDE.
I believe there may be uses for Goto... I've just never seen them.
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?
#5
Posted 09 September 2009 - 12:35 PM
I used to use it a lot in basicA
and occasionally in QuickBasic,
since then I haven't used it.
(whoops... showing my age)
and occasionally in QuickBasic,
since then I haven't used it.
(whoops... showing my age)
#6
Posted 09 September 2009 - 01:07 PM
QuickBasic... the good old days when you could start a loop at 0 and poke 0 into the loop variable
Until DOS froze, that is.

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog
My MineCraft server site: http://banishedwings.enjin.com/
#7
Posted 09 September 2009 - 03:18 PM
I think goto just makes it terribly hard to read and maintain code. Structured programming took over.
#8
Posted 09 September 2009 - 04:48 PM
Yea, back when you could output whatever binary pattern youQuickBasic... the good old days when you could start a loop at 0 and poke 0 into the loop variable
Until DOS froze, that is.
wanted on the bits of your printer port w/ only 1 command!!
The good old days...

#9
Posted 09 September 2009 - 05:20 PM
People don't use goto because of the very good reasons given by Edsger Dijkstra in his article: "Goto Statement Considered Harmful".
I think the only justifiable gotos in C are in lieu of exceptions. In any case, one should just use setjmp.h
I think the only justifiable gotos in C are in lieu of exceptions. In any case, one should just use setjmp.h
Watches: Nanoha, Haruhi, AzuDai. Listens to: E-Type, Dj Melodie, Nightcore.
"When people are wrong they need to be corrected. And then when they can't accept it, an argument ensues." - MeTh0Dz
"When people are wrong they need to be corrected. And then when they can't accept it, an argument ensues." - MeTh0Dz
#10
Posted 09 September 2009 - 05:55 PM
One thing that I forget to keep in mind when developing is that I may not always be the person working on the code I'm writing. This sometimes results in code that is messy and hard to maintain due to bad naming, structure, or lack of clear comments.
-CDG10620
Software Developer
Software Developer
#12
Posted 10 September 2009 - 02:07 AM
Goto can make code hard to follow, or drag functions out when it could be split into two (or more) functions. It can also make modifying code hard. IMO.
Interested in participating in community events?
Want to harness your programming skill and turn it into absolute prowess?
Come join our programming events!
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download