AOA Forums AOA Forums AOA Forums Folding For Team 45 AOA Files Home Front Page Become an AOA Subscriber! UserCP Calendar Memberlist FAQ Search Forum Home


Go Back   AOA Forums > Software > Programming and Assembly Language

Programming and Assembly Language Please read this Topic's rules!!


Reply
 
LinkBack Thread Tools Rate Thread
  #1 (permalink)  
Old 29th May, 2007, 04:42 PM
MrSeanKon's Avatar
OcBible Creator
 
Join Date: June 2005
Location: Somewhere in Greece
Posts: 788

Do you use goto?

What's your opinion gizmo???
As you see in OcBible source code I use it sometimes.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 29th May, 2007, 04:59 PM
Gizmo's Avatar
Chief BBS Administrator
BassTeroids Champion, Global Player Champion, Aim & Fire Champion, Puzzle Maniax Champion, Othello Champion, Canyon Glider Champion, Unicycle Challenge Champion, YetiSports 9: Final Spit Champion, Zed Champion
 
Join Date: May 2003
Location: Webb City, Mo
Posts: 16,178
Send a message via ICQ to Gizmo Send a message via AIM to Gizmo Send a message via MSN to Gizmo Send a message via Yahoo to Gizmo Send a message via Skype™ to Gizmo

I've yet to find a situation in any language other than assembly where a goto statement was used that I couldn't rewrite without a goto.

I find that the goto statement tends to create clutter and cause problems with logic that you wouldn't have otherwise. In addition, handling goto is a major PITA for compilers, because you have to keep track of how many nesting levels you have and things of that nature.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 29th May, 2007, 05:05 PM
MrSeanKon's Avatar
OcBible Creator
 
Join Date: June 2005
Location: Somewhere in Greece
Posts: 788

goto is more common in FORTRAN.
Do you use it??
Only in the first year (when I was student) LOL....
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 29th May, 2007, 05:20 PM
Gizmo's Avatar
Chief BBS Administrator
BassTeroids Champion, Global Player Champion, Aim & Fire Champion, Puzzle Maniax Champion, Othello Champion, Canyon Glider Champion, Unicycle Challenge Champion, YetiSports 9: Final Spit Champion, Zed Champion
 
Join Date: May 2003
Location: Webb City, Mo
Posts: 16,178
Send a message via ICQ to Gizmo Send a message via AIM to Gizmo Send a message via MSN to Gizmo Send a message via Yahoo to Gizmo Send a message via Skype™ to Gizmo

It's been 25 years since I've written anything in Fortran. Even then, I tended to avoid goto.

Really, assembly is the only place where I commonly use goto (usually called jump), and that has more to do with the restrictions inherent in the way you have to write assembly than anything else.

Last edited by Gizmo; 29th May, 2007 at 05:21 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 29th May, 2007, 05:50 PM
MrSeanKon's Avatar
OcBible Creator
 
Join Date: June 2005
Location: Somewhere in Greece
Posts: 788

Usually I use goto when I want to jump from a nested loop outside cos break does not do this.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 29th May, 2007, 06:07 PM
danrok's Avatar
AOA Staff
 
Join Date: March 2003
Location: Great Britain
Posts: 18,917

When I worked as a programmer, use of "goto" was banned.

Jumping out of a loop, is very bad practice.

What I might do was create a variable called, say, error_code. Set it to 0 by default, then test it as part of your loop logic.

In English:

While whatever and error_code equals 0, then do
open a file and read it, else error_code = 1
Repeat the do loop

If error_code equals 1 then display message about being unable to open the file, else display message saying process completed.

Something along those lines!

If it is nested, then so long as you are always testing error_code in each nest, then all loops will exit if error_code is something other than 0.
__________________
Desktop PC: AMD FX-8370E / Asus M5A99X Evo R2.0 Motherboard / 16GB DDR3 RAM / GeForce GTX 970
AOA Team fah

Last edited by danrok; 29th May, 2007 at 06:09 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 29th May, 2007, 06:18 PM
Gizmo's Avatar
Chief BBS Administrator
BassTeroids Champion, Global Player Champion, Aim & Fire Champion, Puzzle Maniax Champion, Othello Champion, Canyon Glider Champion, Unicycle Challenge Champion, YetiSports 9: Final Spit Champion, Zed Champion
 
Join Date: May 2003
Location: Webb City, Mo
Posts: 16,178
Send a message via ICQ to Gizmo Send a message via AIM to Gizmo Send a message via MSN to Gizmo Send a message via Yahoo to Gizmo Send a message via Skype™ to Gizmo

I do something very similar, except I generally just set a boolean var. If it is true, then I want to exit the loop. If I have two different loops, and the outer loop needs to run even if the inner loop exits early (or needs to exit under its own conditions) then I may have several different booleans for the purpose, but it is the same idea.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 29th May, 2007, 08:23 PM
danrok's Avatar
AOA Staff
 
Join Date: March 2003
Location: Great Britain
Posts: 18,917

Yes, now after dusting my memory, used a boolean as well, and had another variable for specifying the type of error (if needed).
__________________
Desktop PC: AMD FX-8370E / Asus M5A99X Evo R2.0 Motherboard / 16GB DDR3 RAM / GeForce GTX 970
AOA Team fah
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 1st June, 2007, 08:52 AM
MrSeanKon's Avatar
OcBible Creator
 
Join Date: June 2005
Location: Somewhere in Greece
Posts: 788

Quote:
Originally Posted by gizmo
PITA
What's this gizmo could you explain it?
I am not a proffesional programmer!
__________________

Last edited by MrSeanKon; 1st June, 2007 at 09:38 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 1st June, 2007, 09:10 AM
chrisbard's Avatar
Benchmarker
 
Join Date: March 2003
Location: Earth
Posts: 8,252
Send a message via Yahoo to chrisbard

Performance Index Target Aquired !
__________________
I've heard that linux community came up with better implemented security in it's latest Linux Mint Gold version, it's actually preventing the user to log in, thus posing 0 risk in contamining the computer with malware! Well done to the open source community!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 1st June, 2007, 09:37 AM
MrSeanKon's Avatar
OcBible Creator
 
Join Date: June 2005
Location: Somewhere in Greece
Posts: 788

Thanks!
It is an acronym!
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 1st June, 2007, 09:47 AM
chrisbard's Avatar
Benchmarker
 
Join Date: March 2003
Location: Earth
Posts: 8,252
Send a message via Yahoo to chrisbard

Talking

Gotcha I can be a major PITA sometimes !
__________________
I've heard that linux community came up with better implemented security in it's latest Linux Mint Gold version, it's actually preventing the user to log in, thus posing 0 risk in contamining the computer with malware! Well done to the open source community!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 1st June, 2007, 09:57 AM
MrSeanKon's Avatar
OcBible Creator
 
Join Date: June 2005
Location: Somewhere in Greece
Posts: 788

LEET!
I can imagine why........
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 1st June, 2007, 07:02 PM
Daniel ~'s Avatar
Chief BBS Administrator
 
Join Date: September 2001
Location: Seattle Wa.
Posts: 45,606

A more common English usage would be Pain In The Ass. As such The bard serves as a sterling example! ":O}
__________________
"Though all men live in ignorance before mystery,
they need not live in darkness...
Justice is foundation and Mercy ETERNAL
."
DKE

"All that we do is touched by Ocean
Yet we remain on the shore of what we know."
Richard Wilbur

[img]/forum/attachments/random-nonsense/16515-sigs-dan_drag.jpg[/img]
Subscribers! Ask Pitch about a Custom Sig Graphic

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 2nd June, 2007, 07:54 AM
chrisbard's Avatar
Benchmarker
 
Join Date: March 2003
Location: Earth
Posts: 8,252
Send a message via Yahoo to chrisbard

Sheesh Dan why didn't you just give the short explanation?
__________________
I've heard that linux community came up with better implemented security in it's latest Linux Mint Gold version, it's actually preventing the user to log in, thus posing 0 risk in contamining the computer with malware! Well done to the open source community!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 2nd June, 2007, 11:07 AM
Samuknow's Avatar
Member
 
Join Date: September 2001
Location: Indianapolis, Indiana
Posts: 8,941
Send a message via MSN to Samuknow

I think you were the short explanation.....
__________________
Quote:
Originally Posted by Daniel ~ View Post
It's OKAY WE accept you as you think you are here! ":O}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 2nd June, 2007, 12:28 PM
chrisbard's Avatar
Benchmarker
 
Join Date: March 2003
Location: Earth
Posts: 8,252
Send a message via Yahoo to chrisbard

Shuddup Sam what are you, his lawyer?
__________________
I've heard that linux community came up with better implemented security in it's latest Linux Mint Gold version, it's actually preventing the user to log in, thus posing 0 risk in contamining the computer with malware! Well done to the open source community!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 7th June, 2007, 04:42 PM
skool h8r's Avatar
Member
 
Join Date: January 2005
Location: Rotherham, UK
Posts: 3,157
Send a message via MSN to skool h8r

Quote:
Originally Posted by MrSeanKon
goto is more common in FORTRAN.
It's even more common in batch
__________________
i7 2600K (4.3Ghz 1.34v) | GTX580 | 16GB (4x4GB) Patriot Viper Sec. 5 Ser. 2 (1866 - 9-11-9-27) | P67A-UD4-B3
Corsair AX1200 | Vertex II 240GB SSD | 4TB RAID0 (Samsung HD204UI) | Logitech G930 Wireless Headset

YouTube - Benchmark Results (Coming Soon!)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 7th June, 2007, 08:30 PM
Favu's Avatar
AOA's resident barman
 
Join Date: October 2005
Location: /Wales/Abergavenny
Posts: 4,004
Send a message via ICQ to Favu Send a message via AIM to Favu Send a message via MSN to Favu

And most common in infinite loops.

Not that I have ever sabotaged a computer museum exhibit in such a fashion.

Honest officer.
__________________
AOA Team fah
 

Custom 8-bit Sharp Z80 @ 4.194304 MHz
Reflective LCD @ 160 × 144
8 kByte S-RAM






Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



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

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Goto first unread message doesn't always work right. Áedán Forum Feedback and Suggestion Box 7 29th December, 2001 01:25 AM


All times are GMT +1. The time now is 01:54 PM.


Copyright ©2001 - 2023, AOA Forums
Don't Click Here Don't Click Here Either

Search Engine Friendly URLs by vBSEO 3.3.0