|
Programming and Assembly Language Please read this Topic's rules!! |
![]() |
| LinkBack | Thread Tools | Rate Thread |
| ||||
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. |
| ||||
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 ![]() Last edited by danrok; 29th May, 2007 at 06:09 PM. |
| ||||
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. |
| ||||
Yes, now after dusting my memory, used a boolean as well, and had another variable for specifying the type of error (if needed). |
| ||||
Performance Index Target Aquired ! |
| ||||
![]() Gotcha ![]() ![]() |
| ||||
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 |
| ||||
Sheesh Dan why didn't you just give the short explanation? ![]() |
| ||||
Shuddup Sam what are you, his lawyer? ![]() |
| ||||
Quote:
![]()
__________________ 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!) |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Rate This Thread | |
| |
![]() | ||||
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 |