Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 20th, 2006, 9:09 PM   #21
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 572
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
Quote:
Originally Posted by Indigno
My programming teacher absolutely hates them. I find them dead usefull and a lot easier to set than loops. I asked him once and all he could come up with is "I dunno, I just don't like them."
I used to hate the concept of loops but really they are not that hard to under stand
[PHP]
for(int index; i < 10; i++)
{
example code;
}
[/PHP]

the middle part is saying that it will perform the loop while something is true after it is not true it ends the loop. simple concept and a lot easier to understand then "Goto's"
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is offline   Reply With Quote
Old Feb 20th, 2006, 9:14 PM   #22
Ęthereal Haze
Newbie
 
Join Date: Feb 2006
Location: -=()N-=()=-C()=-
Posts: 7
Rep Power: 0 Ęthereal Haze is on a distinguished road
Send a message via AIM to Ęthereal Haze Send a message via MSN to Ęthereal Haze Send a message via Yahoo to Ęthereal Haze
You Have A Good Point There. : )
-Still Pouting About How The Sake Affected Him-..... Bad Sake.....
(Sake = Japanese Rice Wine , btw.)
Ęthereal Haze is offline   Reply With Quote
Old Feb 20th, 2006, 9:19 PM   #23
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 630
Rep Power: 4 Jessehk is on a distinguished road
The best argument against goto's that I have ever seen was a memory-game (like making matches of cards and then trying to remember where they were located) I made in TI-Basic on my graphing calculator.

:eek:
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!
Jessehk is offline   Reply With Quote
Old Feb 20th, 2006, 9:58 PM   #24
Ęthereal Haze
Newbie
 
Join Date: Feb 2006
Location: -=()N-=()=-C()=-
Posts: 7
Rep Power: 0 Ęthereal Haze is on a distinguished road
Send a message via AIM to Ęthereal Haze Send a message via MSN to Ęthereal Haze Send a message via Yahoo to Ęthereal Haze
Lol!
Honestly, I Cannot Stand The Gotosite Command. I Used it three times, maybe throughout the entire length I have been learning.. (Prolly about 3 months ... LMFAO )
Ęthereal Haze is offline   Reply With Quote
Old Feb 20th, 2006, 10:00 PM   #25
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
I think Aethereal STILL doesn't know what's being discussed here. Trade that sake in on a book, and yeah, I know what sake is.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 20th, 2006, 10:11 PM   #26
Ęthereal Haze
Newbie
 
Join Date: Feb 2006
Location: -=()N-=()=-C()=-
Posts: 7
Rep Power: 0 Ęthereal Haze is on a distinguished road
Send a message via AIM to Ęthereal Haze Send a message via MSN to Ęthereal Haze Send a message via Yahoo to Ęthereal Haze
Guess I don't.. :-?
..............................
.....................
............................. Oh well, Maybe I Will Figure It Out Sooner Or Later....
<-- Vb.. Mayhaps it was another language they were mentioning?
Ęthereal Haze is offline   Reply With Quote
Old Feb 21st, 2006, 1:20 AM   #27
Darkhack
Hobbyist Programmer
 
Darkhack's Avatar
 
Join Date: Dec 2005
Location: Kansas City
Posts: 102
Rep Power: 3 Darkhack is on a distinguished road
Send a message via AIM to Darkhack
Don't worry about it. Quite honestly, I find it better that beginners never hear the words "goto" in their entire programming life. Unless your name is Linus Torvalds, Richard Stallman, Dennis Richie, or Bjarne Stroustrup, you have no use messing with goto statements. Some people say you should NEVER use them, but their are times when it is acceptable to use them for the sake of performance. Unless you are developing an operating system kernel, a compiler, or advanced robotics/AI software, then I would recommend you pretend as if they never existed. And when I say "for the sake of performance" I don't mean using them instead of loops; I mean using them along side in a very, very scarce manner. There are probebly less than 100 programmers on the face of the planet whom I would trust with using goto statements. Also, while on the topic, for the sake of arguement, you could, in theory, use goto statements in such a way that they would mimic regular loops. Although that would be about as pointless as running a lawn mower through a parking lot.
Darkhack is offline   Reply With Quote
Old Feb 21st, 2006, 2:01 AM   #28
Ęthereal Haze
Newbie
 
Join Date: Feb 2006
Location: -=()N-=()=-C()=-
Posts: 7
Rep Power: 0 Ęthereal Haze is on a distinguished road
Send a message via AIM to Ęthereal Haze Send a message via MSN to Ęthereal Haze Send a message via Yahoo to Ęthereal Haze
Quote:
Originally Posted by Darkhack
Don't worry about it. Quite honestly, I find it better that beginners never hear the words "goto" in their entire programming life. Unless your name is Linus Torvalds, Richard Stallman, Dennis Richie, or Bjarne Stroustrup, you have no use messing with goto statements. Some people say you should NEVER use them, but their are times when it is acceptable to use them for the sake of performance. Unless you are developing an operating system kernel, a compiler, or advanced robotics/AI software, then I would recommend you pretend as if they never existed. And when I say "for the sake of performance" I don't mean using them instead of loops; I mean using them along side in a very, very scarce manner. There are probebly less than 100 programmers on the face of the planet whom I would trust with using goto statements. Also, while on the topic, for the sake of arguement, you could, in theory, use goto statements in such a way that they would mimic regular loops. Although that would be about as pointless as running a lawn mower through a parking lot.
Hmmm............................... Yes, I See... I Do Very Well See Your Point........ I May Be A Newby To Forums, And May Not Understand What Is Going On Completely, ()---This Was Stated By Someone Earlier, So I Will Go Along With It, lol.....---() But I Sure Know That the Goto Command Can Be Quite Efficient. It All Depends On WHat You Use It For.
Ęthereal Haze is offline   Reply With Quote
Old Feb 21st, 2006, 7:10 AM   #29
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
But I Sure Know That the Goto Command Can Be Quite Efficient.
Forgive me, but you don't know shit about the matter.

A goto is no more efficient that a brace, say, in C/C++. Typically, in a high level language, 'goto' is a statement that causes the path of execution to transfer to a point other than the instruction following in normal sequence. This is a common thing and one of the basic reasons our computers work. The destination of the goto is indicated by a label representing an instruction located somewhere else. The scope or range of this "jump" may be restricted, or it may not be. Because it is a unilateral movement, there's nothing that supports any kind of inference as to whether or not the movement is logical or rational, in terms of program flow.

If you dissect a "while" loop, you get something like this:

TOP:
Evaluate expression.
If expression is false goto END
Do some work here conditioned on the expression being true.
Evaluate some expression, if true goto TOP
Do some more work here
Evaluate some expression, if true goto END
Do some more work here
END

In C, that would look like:

while (expr)
{
Do some work
If some expr2 continue
More work
If some expr3 break
Even more work
}

Note that the 'while' (TOP) is a label who's location is represented by the opening brace.
END is a label representing the, well, end
Continue is a goto to TOP.
Break is a goto to END.

Note that VB would use a WHILE....WEND construct. Languages have various syntactical requirements of their own. PL/Z would use DO....OD.

Note also that the use of euphemistic things like braces, continue, and break, have a salubrious effect. They localize the operation. They are "in view", so to speak. One can see all the possible paths of instruction flow and the logical orderliness thereof. If the goto shoots off thousands of instructions one has no inkling of the rationale behind the construction of the program. Sometimes it goes off, comes back near, shoots off again, ad nauseum. This is referred to as 'spaghetti code.'

One might be tempted (and it might be defensible) to use a goto to exit a deep nest under fatal or near fatal error conditions. It's possible to exit otherwise, but can be a real pain in the rear. Thus the devil tempts us. Linus Torvald and his flunkys overused goto in the kernel. There is some defense, as it is a practical way to deal with exceptional failures, provided you know what you're doing and what needs to be unwound. The BSD kernel, compared to the Linux kernel, is a fine expression of how to do it better.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 21st, 2006, 8:52 AM   #30
master007
Newbie
 
master007's Avatar
 
Join Date: Feb 2006
Posts: 8
Rep Power: 0 master007 is on a distinguished road
The GOTO statement (*hints while pointing to aethereal*) should only be used, as someone said earlier for breaking out of loops in the case of error catching. This is its best application.
It can also be used while testing your code.

p.s. I could drink a few jugs of warm sake right now, please stop mentioning its yummy/honourable name. .
master007 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:00 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC