Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Why doesn't anyone use Goto anymore?


  • Please log in to reply
21 replies to this topic

#13 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 10 September 2009 - 04:09 AM

Apparently PHP developers will be using Goto again "coming soon to a PHP release near you".
  • 0

#14 Guest_h4x_*

Guest_h4x_*
  • Guest

Posted 10 September 2009 - 06:25 AM

i write code for my own purposes in c and i use goto.
  • 0

#15 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 10 September 2009 - 07:04 AM

My personal philosophy: don't use goto EVER. I saw the link that talked about "rewriting to remove gotos". I admit it's tricky to remove them, but they were all examples where it wasn't needed in the first place. Boundary checking!
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/


#16 marwex89

marwex89

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 2857 posts

Posted 10 September 2009 - 08:08 AM

I haven't used goto in a higher level language more than a few times, there are usually better ways to do stuff..
  • 0
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#17 debtboy

debtboy

    CC Devotee

  • Just Joined
  • PipPipPipPipPipPip
  • 499 posts

Posted 10 September 2009 - 09:09 AM

i write code for my own purposes in c and i use goto.

For once I kind of agree...

We should follow best practices, and I can't think of a good reason to use it,
but that doesn't mean there isn't one and best practices is only a guide.
GOTO is a straight forward command that does what it says, no strings attached :)
GOTO exists in many languages... WHY?
(A good extension to this thread would be: Name all programming languages where goto exists)

I don't use GOTO, but if I had to work on someone else's code who does,
I wouldn't have a problem with it.

Additional NOTE:
GOTO exists in perl and I always heard there is
no wrong way to write a perl program. :lol:
  • 0

#18 relapse

relapse

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 323 posts

Posted 10 September 2009 - 10:29 AM

No one uses Goto anymore because it sucks ** and is a plague upon decent coders. You get a bunch of n00bs jumping from line 560 to line 200, wtf? Ever heard of a function?

Goto == spaghetti code == **
  • 0

#19 Donovan

Donovan

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 633 posts
  • Location:Nevada
  • Learning:Java, Objective-C, PHP, JavaScript, Perl, PL/SQL, ActionScript, VBScript, Others

Posted 19 August 2010 - 01:17 AM

Interesting replies, I will be sure to keep a lot of this in mind.
  • 0

#20 Alexander

Alexander

    YOL9

  • Moderator
  • 3963 posts
  • Location:Vancouver, Eh! Cleverness: 200
  • Programming Language:C, C++, PHP, Assembly

Posted 19 August 2010 - 02:06 AM

Do you get an award for digging up 7+ threads that are years old in one hour?
  • 0

All new problems require investigation, and so if errors are problems, try to learn as much as you can and report back.


#21 Donovan

Donovan

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 633 posts
  • Location:Nevada
  • Learning:Java, Objective-C, PHP, JavaScript, Perl, PL/SQL, ActionScript, VBScript, Others

Posted 19 August 2010 - 11:23 AM

Nope, but these are my old threads and I decided to check all my old threads just for ****s and grins and for memories..
  • 0

#22 DarkLordCthulhu

DarkLordCthulhu

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 422 posts
  • Location:The bash shell
  • Programming Language:C, JavaScript, Bash, Others
  • Learning:Ruby, Others

Posted 19 August 2010 - 03:31 PM

Gotos break the structural organization of a program. Most programming languages organize code into blocks. These blocks are discrete sections of code that execute under a certain condition or a certain number of times. If a goto is in there, then there is no longer any structure, the blocks are no longer discrete, and spaghetti code results. The main disadvantage of gotos is that they make code nearly impossible to read.
  • 0




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download