![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#31 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Quote:
__________________
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 |
|
|
|
|
|
|
#32 |
|
Newbie
Join Date: Feb 2006
Posts: 8
Rep Power: 0
![]() |
Using multiple goto statements would however add a routed break from the loop instead of restarting right from end of the loop statement.
example, the following psudocode:- start loop EvaluationCode() if errortype=1 then goto error1 if errortype=2 then goto error2 if errortype=3 then goto error3 end loop error1: statements goto finish error2: statements goto finish error3: statements finish: end program I know the CASE statement can be used in the above code, I never said using GOTO is good coding or the best solution, in all situations I would agree that it would be best to code it in another way. |
|
|
|
|
|
#33 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
And you can't figure out how to do that properly? Shame on you. Hit the books and make sure potential interviewers don't see your post.
__________________
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 |
|
|
|
|
|
#34 |
|
Newbie
Join Date: Feb 2006
Posts: 8
Rep Power: 0
![]() |
wow you're fast. I was editing the post above, sorry. I posted it and then said to myself. hmmm Da wei is gonna shoot you down, you better state the obvious. sigh so said so done :p
Last edited by master007; Feb 21st, 2006 at 11:32 AM. |
|
|
|
|
|
#35 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
I apologize if the response seems a little strong. I have some concerns about novices being misdirected or instructed in gross error. It seems inappropriate to me (personal opinion, of course, but shared by a large majority of competent practitioners) that an example of bad programming practice would be deliberately provided.
__________________
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 |
|
|
|
|
|
#36 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4
![]() |
Quote:
while True:
EvaluationCode()
if errortype == 1:
statements
break
if errortype == 2:
statements
break
if errortype == 3:
statements
breaktry:
while True:
EvaluationCode()
except Exception, errortype:
if errortype == 1:
statements
elif errortype == 2:
statements
elif errortype == 3:
statments |
|
|
|
|
|
|
#37 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
Hmm, I read an article a while back which advocated the use of gotos in a lot of cases -- I can't say I agree with the article, but it was a well-written article nevertheless. I can't seem to find it though, if I find it I'll link it.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
|
|
#38 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
I feel compelled to add that there are televangelists that make well-presented arguments to seemingly rational people and are successful enough at it that they commute between mansions in Learjets.
I didn't exactly write a well-thought-out and immaculately presented treatise in post #29, but I think it hints at the very few situations where the use of a goto might be advocated. It's not a LOT of cases, by any stretch of the imagination. I would look askance at one who preaches otherwise, however eloquently. One may make a case that in a language without exception handling, the equivalent functionality might be implemented using 'goto.' I reiterate that the task should be undertaken by one who is intimately familiar with what happens to system state before and after such machinations.
__________________
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 |
|
|
|
|
|
#39 |
|
Newbie
|
ACK!
As I Said, . It All Depends On WHat You Use It For. -End of Story- Gah. >.<; Now If You Will Excuse Me I Need To Finish A Project In Vb6. |
|
|
|
|
|
#40 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
You keep popping things into the thread that indicate you STILL have no idea what we're talking about. "As I said..." indeed! Good of you to dictate the end of the story, though, we were waiting on an authoritarian figure to do that.
You're excused.
__________________
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|