I was a bit surprised to see that LinuxCNC didn't have an unconditional 
jump, ie a GOTO.  I chalked it up to LinuxCNC being written by 
programmers, and the structured programming Nazis have beaten it into 
their heads that GOTO statements are evil, and only stupid BASIC 
spaghetti programmers use them.

I'm an electrical engineer, but I specialized in computers and digital 
electronics.  I pretty much have a minor in computer science.  I 
remember my first programming class, way back in 1978. I had read the 
entire textbook the summer before my freshman year. Near the end of the 
class, I used a GOTO in one of my programming assignments.  The teaching 
assistant went nuts.  My PL/C program was returned, and she had circled 
the GOTO statement and scrawled, "Where did you get this?!?!?"  The 
language had a GOTO statement, and it was listed with all of the other 
syntax in an index in the back of the book.  That was when the 
structured programming Nazis were just getting a philosophical foothold.

During my career, I did a LOT of assembler programming using RISC 
(reduced instruction set) microcontrollers.  The RISC microcontroller 
instruction set had 36 instructions and one of them was a GOTO.  
Sometimes, you ALWAYS want to go somewhere, and in my opinion, it's not 
sloppy spaghetti code to use a GOTO.  This is particularly true in real 
world control applications, such as microcontrollers, or CNC control.  A 
GOTO is much more structured, intuitive and elegant than forcing a 
conditional branch instruction to be an unconditional branch by using 
some condition that is always true.  I've actually seen DO WHILE 0 < 1 
when looking at other people's code.  That's just dumber than dirt.  
It's the sort of ugly code that results from the religious belief that 
the GOTO is anathema.

    /Only a Sith deals in absolutes./
    /  - Obi-Wan Kenobi/


In some G-code I wrote last week, I wanted to always return to make 
another part on the lathe.  I planned to manually stop it when I wanted 
to stop.  I wanted the operator to control that, and not have the G-code 
force it on the operator.  Instead, I made a DO UNTIL loop with a 
counter that would make all of the parts that would fit on a piece of 
bar stock.  Even then, the lack of any facility for unconditional 
branching seems awkward at best.





On 10/02/2014 09:50 PM, Jack Coats wrote:
> IMHO, GOTOs aren't bad.  They are used poorly.  Most situations they
> are not needed, but in languages without do-while or do-until type
> loops, they do help.
>
> I am not advocating use of GOTOs or similar technologies (one guy
> suggested a 'COMEFROM' ... some tek ideas don't every fly).  But using
> it just because you don't want to re-organize the program isn't a
> reasonable excuse (trust me, writing it well will make maintenance
> SOOO much easier in the long run, or even make portions reusable in
> other programs).
>
> OK, back in my hole. ... Pulling the rock back over it now.
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>
>

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to