Where to find 'Real' programmers online?

GOTO is useful for recursion in languages which don't have tail call optimization; It is trivial to write a naive factorial function in x86 assembly using jumps and labels.
 
It is interesting to see the same tired GOTO discussion being promulgated 70 years after Edsger Dijkstra wrote "GOTOs, considered harmful". The mass phobia of GOTO has always been unfounded. A GOTO is a valid way of exiting any logical block of code, but should never be used to enter a logical block. Unconditional jumps are in the machine code for valid reason.
 
It is interesting to see the same tired GOTO discussion being promulgated 70 years after Edsger Dijkstra wrote "GOTOs, considered harmful". The mass phobia of GOTO has always been unfounded. A GOTO is a valid way of exiting any logical block of code, but should never be used to enter a logical block. Unconditional jumps are in the machine code for valid reason.

There are better language constructs to exit nested logical blocks than goto. Well, not in C but elsewhere.
 
This will make me sound naive but...
A few of my mentors--A CS Professors and a CS Engineer--always said there are always better options than GOTO. Not sure if they were speaking to me (alone--and they used them themselves) but I was taught to reevaluate my design choices if GOTO was typed.
 
Bleh! .... #define goto(a,b) do{ return 1; }

Maybe it is. I'm okay with not using it (one less thing for me to mess up) because I have a hard enough time with ++i vs i++. I believe my mentors were trying to get me to think about the algorithms more before writing code because I was constantly getting vague instructions like "this can be done in one pass." or "dont sort." which lead me down some really interesting concepts (I miss those talks).
 
You all never heard of the "please come from" statement...

When writing compilers, you learn to really hate goto statements. They produce one hell of flow graphs and make it hard to use elegant and fast algorithms for register allocation, loop optimization, ...
 
Since this thread is originally about "Real programmers" I'll comment about GOTO one more time and then shut up. When I'm evaluating the sophistication of a peer or possible subordinate I want to know whether they truly understand the computer programming language landscape, or if they just memorized and regurgitate based on an expected design pattern when facing a particular task. The GOTO is a prime test to see if they TRULY understand computer science concepts. Sure, while from the high-level language-centric POV, GOTO ist verboten, if they want to impress me they will understand that those "preferred" exit strategies will still generate unconditional branch statements at the assembly level, thus GOTOs...Ah, the lightbulbs ignite. LOL Essentially the higher level languages are "hiding" what is necessary and fundamental in the first place, but still exists!
 
Essentially the higher level languages are "hiding"
They are "abstracting". Hiding details that are not particularly relevant at their level. Just as a procedure call is an abstraction. You can always do
Code:
    move    *sp, arg1
    sub        sp, 4
    move    *sp, label1
    sub        sp,    4
    jmp        func1
label1:
    add        sp,8
instead of func1(arg1).
 
It is interesting to see the same tired GOTO discussion being promulgated 70 years after Edsger Dijkstra wrote "GOTOs, considered harmful". The mass phobia of GOTO has always been unfounded. A GOTO is a valid way of exiting any logical block of code, but should never be used to enter a logical block. Unconditional jumps are in the machine code for valid reason.
Around 1971, I worked with a guy who was rewriting a system that monitored dynamometer test stands for truck engines in FORTRAN. (It ran on an IBM 1800 system.) He had adopted structured programming, and he charted his programs using Nassi–Shneiderman structured flowcharts, then implemented them in FORTRAN using GOTOs only where necessary to implement the structured programming constructs. His GOTOs were not harmful.

I have also inherited programs where the liberal use of GOTOs made the code path look it was designed by a Cocker Spaniel with ADHD. (I know, that is redundant.)
 
When writing compilers, you learn to really hate goto statements. They produce one hell of flow graphs and make it hard to use elegant and fast algorithms for register allocation, loop optimization, ...
Computers are created to do real useful job, not only to run compilers. Same for elegant algorithms.
 
Computers are created to do real useful job, not only to run compilers. Same for elegant algorithms.
Complexety invites in bugs, that goes for complex plans, complex algorithms and complex control flow. I have seen code ridden with a plaque of gotos, where the flow graph (in pencil on a chain printer stack of dead trees) looked like your 3yo threw spaghetti on the wall. Finding out why that thing did something was almost impossible. Whatever time was saved by the nest of gotos was eaten 10 fold in debugging that mess.
 
Complexety invites in bugs, that goes for complex plans, complex algorithms and complex control flow. I have seen code ridden with a plaque of gotos, where the flow graph (in pencil on a chain printer stack of dead trees) looked like your 3yo threw spaghetti on the wall. Finding out why that thing did something was almost impossible. Whatever time was saved by the nest of gotos was eaten 10 fold in debugging that mess.
CodeRunner.jpg
 
I have seen code ridden with a plaque of gotos, where the flow graph (in pencil on a chain printer stack of dead trees) looked like your 3yo threw spaghetti on the wall.
OK. But I hope you make difference between "plague of gotos" and using goto once per 3000 lines. Is a "while ( 1 ) {... break;...}" loop better optimized than single goto with the same logic?
 
OK. But I hope you make difference between "plague of gotos" and using goto once per 3000 lines.
Sure, but in many a case where I see a goto I see that it is not needed and, in fact, produce worse code. There are places a goto is the only way, but it is a tool. You can not hand any tool to everybody and expect them to be equally skilled with that. I usually explain different ways to do things to the developer, and I usually request a good comment explaining why a goto is the way to go in that place, should you really need it.
 
Back
Top