Thread: goto statements

  1. #1
    Registered User
    Join Date
    May 2002

    goto statements

    one of my friends was saying goto statements arent used much in c++ very much, if that is true then alright but if not i would like to know how to use them... cause i cant get my game to go back to the start if someone dies or if they kill something. can someone please help me?

  2. #2
    Registered User
    Join Date
    Apr 2002
    Some people on this board will tell you to never use goto statements. They say if you need to use them you have bad design. In my opinion there are very rare circumstances where you may have to use them for maximum efficiency. I think also you would use them in say BIOS programming or something. In your case, however, I do not think go to statements would be beneficial. You should perhaps call your appropriate functions and wrap them in a simple loop. Check out the basics of a while loop and I think that should probably help you out. Any questions? Just ask.

  3. #3
    Registered User Mario's Avatar
    Join Date
    May 2002
    I agree with Wiz there. I think this is almost a universal truth. There are instances when even the most shaddy aspects of a programming language may be useful.
    As an example I was reading the other day some anti-cracking techniques to use when designing your own serial number software protection schemes... they actually advise you to use goto and use it often as it will make crackers go nuts on their dissasemblers

    If you have a good reason to use it, you go ahead and don't mind the purists. You just have to make sure you really need it and the consequences of using it. But if you are learning the language, be especially careful. It's best to go the hard route than to fall prey of the vices these commands offer.

    Bad practice is not an adjective to qualify a language feature. It's an adjective to qualify a programmer.
    Mario Figueiredo
    Using Borland C++ Builder 5

    Read the Tao of Programming
    This advise was brought to you by the Comitee for a Service Packless World

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002

    Re: goto statements

    The goto statement has been discussed quite a bit in the last couple of days.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. temperature sensors
    By danko in forum C Programming
    Replies: 22
    Last Post: 07-10-2007, 07:26 PM
  2. Does goto have a glitch or...?
    By Blackroot in forum C++ Programming
    Replies: 9
    Last Post: 02-18-2006, 10:40 AM
  3. helpppp
    By The Brain in forum C Programming
    Replies: 1
    Last Post: 07-27-2005, 07:05 PM
  4. Need some help with a basic tic tac toe game
    By darkshadow in forum C Programming
    Replies: 1
    Last Post: 05-12-2002, 04:21 PM
  5. Goto statements, good or bad?
    By Esparno in forum C++ Programming
    Replies: 20
    Last Post: 03-20-2002, 09:16 PM