Click here to Skip to main content
14,578,986 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: In defense of goto Pin
Member 79891223-Jan-20 0:14
MemberMember 79891223-Jan-20 0:14 
GeneralRe: In defense of goto Pin
honey the codewitch3-Jan-20 3:56
mvahoney the codewitch3-Jan-20 3:56 
GeneralRe: In defense of goto Pin
Member 79891223-Jan-20 5:16
MemberMember 79891223-Jan-20 5:16 
GeneralRe: In defense of goto Pin
honey the codewitch3-Jan-20 5:23
mvahoney the codewitch3-Jan-20 5:23 
GeneralRe: In defense of goto Pin
glennPattonWork2-Jan-20 23:13
professionalglennPattonWork2-Jan-20 23:13 
GeneralRe: In defense of goto Pin
Member 79891223-Jan-20 0:35
MemberMember 79891223-Jan-20 0:35 
GeneralRe: In defense of goto Pin
glennPattonWork3-Jan-20 0:41
professionalglennPattonWork3-Jan-20 0:41 
GeneralRe: In defense of goto Pin
Member 79891223-Jan-20 1:32
MemberMember 79891223-Jan-20 1:32 
In machine code, direct jumps are what you use to realize all sorts of structured flow control mechanisms. So there is no way to avoid using jumps when writing machine code / assembler. You still can use it in a disciplined way, though, and add a comment like "Leaving the digit loop" or something like that. You don't just jump from anywhere to anywhere!

For those "Jump there right now!" sounds very much like an exception that must be handled. The problem is: Have you really programmed that jump when that exceptional condition occurs? And what about the mess you are creating on the stack or in half-completed operations - are you prepared to clean up that?

Even the 8051 had programmed interrupts. I can't imagine that anyone use even more primitive controllers today. For those exceptional situations that must be handled now, I would think that a programmed interrupt would be a far better solution than a plain jump to "somwehere", loosing all current context. (A linked jump is not a "jump" as such, but a lightweight function call.)

True enough: When we ten years ago employed hardware graduates, they had learned c programming, and could very well explain the logic circuitry causing the program counter update when an interrupt signal arrived. But when I were referring to the interrupt handlers as a special case of parallel threads, executing side by side with your main thread, they gave me a blank stare. They had never been close to consider an interrupt handler as anything but a place to force the PC register to point to (and maybe set some 'privileged' flag). Hardware guys did not have processes and threads and that kind of stuff under their skin (they didn't even know how compilers created frames on the stack, just that the SP was moved by a call instruction).

To explain to those guys, ten years ago, that running the emergency situation on a separate thread, by a programmed interrupt, would be a lot better, was a tough task. Thankfully, today's graduates, even hardware guys, are familiar with threads and similar stuff. So today I would expect that they either understand to use exceptions, or that they understand the havoc created if a plain jump skips out of a stack frame, or even out of half-baked calculation or data structure update.
GeneralRe: In defense of goto Pin
Rick York3-Jan-20 5:02
mveRick York3-Jan-20 5:02 
GeneralRe: In defense of goto Pin
Mark_Wallace2-Jan-20 23:48
MemberMark_Wallace2-Jan-20 23:48 
GeneralRe: In defense of goto Pin
honey the codewitch3-Jan-20 4:01
mvahoney the codewitch3-Jan-20 4:01 
GeneralRe: In defense of goto Pin
Mark_Wallace3-Jan-20 19:58
MemberMark_Wallace3-Jan-20 19:58 
GeneralRe: In defense of goto Pin
Greg Utas3-Jan-20 1:44
professionalGreg Utas3-Jan-20 1:44 
GeneralRe: In defense of goto Pin
H.Brydon4-Jan-20 16:21
professionalH.Brydon4-Jan-20 16:21 
GeneralRe: In defense of goto Pin
honey the codewitch4-Jan-20 17:00
mvahoney the codewitch4-Jan-20 17:00 
GeneralRe: In defense of goto Pin
Stefan_Lang5-Jan-20 22:22
mveStefan_Lang5-Jan-20 22:22 
GeneralRe: In defense of goto Pin
honey the codewitch5-Jan-20 23:14
mvahoney the codewitch5-Jan-20 23:14 
GeneralRe: In defense of goto Pin
Stefan_Lang5-Jan-20 23:38
mveStefan_Lang5-Jan-20 23:38 
GeneralRe: In defense of goto Pin
honey the codewitch6-Jan-20 6:43
mvahoney the codewitch6-Jan-20 6:43 
GeneralRe: In defense of goto Pin
Stefan_Lang7-Jan-20 22:03
mveStefan_Lang7-Jan-20 22:03 
GeneralRe: In defense of goto Pin
honey the codewitch7-Jan-20 22:09
mvahoney the codewitch7-Jan-20 22:09 
GeneralRe: In defense of goto Pin
Stefan_Lang7-Jan-20 23:36
mveStefan_Lang7-Jan-20 23:36 
GeneralRe: In defense of goto Pin
Stefan_Lang5-Jan-20 22:38
mveStefan_Lang5-Jan-20 22:38 
GeneralRe: In defense of goto Pin
honey the codewitch5-Jan-20 23:15
mvahoney the codewitch5-Jan-20 23:15 
GeneralMini CCCs 160 Pin
Tim Deveaux2-Jan-20 17:30
MemberTim Deveaux2-Jan-20 17:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.