I understand that this is an ongoing debate; my question is mainly should we always start this debate everytime a newb asks about goto? It really seems counter-productive. "We" understand this debate however, in most cases, the newb will not and thus could derive false conclusions.This is, one of the many, reasons I have considered the possibility of starting a "members only" kind of programming site.
Hope is the first step on the road to disappointment.
I would tend to agree with your concept, however I believe base on the OP's code and questions, the conservative route in this case was appropriate.
Now, are there reasons to use goto in C? My answer would be yes. Even more so, sometimes the reason to use it may seem convoluted and not immediately apparent (John Carmack), however this was not the case. Personally, I would prefer the concept buried in the language until at least 3rd or 4th year level; past once you understand what exactly the effect of your code is on the computer.
Haha...we all wish we could go back to those days......
Unfortunately..................................... ................Originally Posted by quzah
You could approximate that, e.g.,Originally Posted by quzah
then claim that this is M BASICCode:M10: printf( "hello world\n" ); M20: goto M10;
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
the order is as follows:
Code:int number; printf ("www."); goto x; z: printf ("you"); goto y; x: printf ("ilove"); goto z; y: printf (".com"); getch (); return 0; }
vikasvijayan, don't you ever read the previous responses to the threads that you reply to?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
All he did is take the code box from the first post and hit enter after every line.
Quzah.
Hope is the first step on the road to disappointment.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
The guys who wrote "Numerical recipes" make an interesting point regarding goto. They say it's not the goto itself that is the problem, but the label it branches to. When you see a label you immediately think "Uh oh! Now I have to find what bit of code transfers control here". I'm not sure I agree, particularly if the label is well-named and you never use goto to jump backwards, but I get their point.
Code:while(!asleep) { sheep++; }