Need help with goto in c++

This is a discussion on Need help with goto in c++ within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by quzah I find it often helpful to make my entire program just one huge main function, with ...

  1. #16
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Quote Originally Posted by quzah
    I find it often helpful to make my entire program just one huge main function, with all my variables global, and then just use goto jumps to get where I need. The benifit of this and the globals, is that on the off chance main gets too big, I can always just make one more big function, and all the variables are accessable to it. This lends greatly to the overall readability of the program.

    Quzah.
    Good advice, as always, quzah. The glue that's required to couple together functions and modules just makes your program bigger as well. If you use as few functions and classes as possible, you can spend less time and space on putting things together and more on the meat of the program. That's where real productivity comes from.
    My best code is written with the delete key.

  2. #17
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    Posts
    704
    These last two post hurt my brain, really.
    c++->visualc++->directx->opengl->c++;
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

  3. #18
    Registered User
    Join Date
    Jul 2004
    Posts
    11
    Quote Originally Posted by quzah
    I find it often helpful to make my entire program just one huge main function, with all my variables global, and then just use goto jumps to get where I need. The benifit of this and the globals, is that on the off chance main gets too big, I can always just make one more big function, and all the variables are accessable to it. This lends greatly to the overall readability of the program.

    Quzah.
    That kinda kills the point of OOP and lower memory usage for variables not often used?

    ~Meloshski

  4. #19
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    quzah was been sarcastic

  5. #20
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Quote Originally Posted by Thantos
    quzah was been sarcastic
    he was? crap, i just spent the last 6 hours rewritting all of my code in main with goto's and globals.

  6. #21
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Meloshski
    That kinda kills the point of OOP and lower memory usage for variables not often used?

    ~Meloshski
    Hell no, it's definately in the spirit of OOP!

    main has a bunch of stuff in it.
    main is a huge function.

    After all, OOP is all about "has a" / "is a" relationships!



    Quzah.
    Hope is the first step on the road to disappointment.

  7. #22
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596


    I bout died when I read Quzah's post. And he didn't even say if he was joking or not. Later I find out that my suspicions were accurate....her was joking. Thank goodness.

    You guys kill me.


    And to the poster I have some really good advice on goto. Avoid it like the plague and pretend that it doesn't exist.

    Anything that can be done with goto can be accomplished with much more finesse using other C/C++ constructs and logic.


    Goto. Danger Will Robinson,....Danger!!!
    Last edited by VirtualAce; 07-06-2004 at 11:50 PM.

  8. #23
    Registered User
    Join Date
    Jul 2004
    Posts
    11
    i used goto.... ONCE. It put a nice little bug in the middle of my program. Later in my C++ bible i learnd, like the last replier "to avoid it like a plague." Not only is it unnecessary but it can produce bugs. Quzah when i saw ur post, i wondered how anyone could say such a thing, i didnt know you were joking but i did know enuff to stay away from such advice.
    tyler

  9. #24
    Registered User
    Join Date
    Jul 2004
    Posts
    8
    Can someone tell me why you need braces around a case statement if it has a variable declaration in it? I did not know that because I never declare variables there but I assumed it just went right down to the end of the switch structure. I will have to try it out when I get home.

Page 2 of 2 FirstFirst 12
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. goto command
    By jhwebster1 in forum C Programming
    Replies: 3
    Last Post: 02-21-2006, 11:32 AM
  3. Does goto have a glitch or...?
    By Blackroot in forum C++ Programming
    Replies: 9
    Last Post: 02-18-2006, 09:40 AM
  4. helpppp
    By The Brain in forum C Programming
    Replies: 1
    Last Post: 07-27-2005, 07:05 PM
  5. 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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21