Re: Programming for Electronics Engineers

From: Keith Williams (krw_at_att.bizzzz)
Date: 01/18/05


Date: Tue, 18 Jan 2005 10:13:21 -0500

In article <a00pu0p4s55g1p616f1jgiqh6449a30k9n@4ax.com>,
jjSNIPlarkin@highTHISlandPLEASEtechnology.XXX says...
> On Tue, 18 Jan 2005 02:45:25 GMT, "Kryten"
> <kryten_droid_obfusticator@ntlworld.com> wrote:
>
> >>>John Larkin <jjlarkin@highSNIPlandTHIStechPLEASEnology.com> wrote:
> >>>[...]
> >>>>That's a lot of trouble to avoid a couple of GOTOs. I never understood
> >>>>the anti-GOTO religion.
> >>>
> >>>Someone said that GOTOs were a bad thing and everyone believed him.
> >
> >I feel that GOTO can be valid in a certain circumstances.
> >
> >Such as GOTO <special exit point>.
> >
> >However people will abuse anything they are offered, so
> >GOTO <valid local jump>
> >gets used a
> >GOTO <any place I damn well please anywhere in the entire program>
> >
> >Given the scope for appalling abuse, it might be wise to recommend very
> >sparing usage.
> >
> >I heard of a guy who's immediate boss (the company boss's son) thought all
> >code should use GOTO almost entirely, and tried to force everyone else to do
> >so.
> >
>
> I prefer very flat programs controlled by conditional GOTOs (or JMPs,
> in assembly) that operate as state machines. After all, not many
> computers have curly brackets in their native instruction sets. What
> language you use, and how you use it, just depends on how you think.

I prefer to use CASE like statements to implement state machines. The
PL/I Select/when fit me like a glove here. VHDL's CASE is not quite as
powerful, but makes very readable state machines. If it's done right
the implementation of the state machine can be determined at
compile/synthesis time, rather than during design.

-- 
  Keith 


Relevant Pages

  • Re: How to develop a random number generation device
    ... Assignments don't crash in assembly, ... think in state machines, so GOTO is perfectly logical. ... conditional branch, or a computed/table driven jump, are the primary ...
    (sci.electronics.design)
  • Re: Goto - finally
    ... all assembler includes a direct JUMP... ... As for programming in C, I don't know what kind of programming other ... people have done in C but some things are by far easiest in C with goto. ... State machines are also easily handled without goto statements. ...
    (comp.lang.php)
  • Re: regarding "goto" in C
    ... >>> that I implement boil down to what I would call state machines with ... >>> I've seen is a switch statement wrapped in a while, ... >> constant expression. ... "goto case" would be possibly a more obvious way to implement the ...
    (comp.lang.c)
  • Re: change variables
    ... enclosing function. ... The problem is knowing whether it does abuse GO TO or not, ... of a goto. ... a target of perform or only the target of a goto ...
    (comp.lang.cobol)
  • Re: Programming for Electronics Engineers
    ... >I feel that GOTO can be valid in a certain circumstances. ... >Given the scope for appalling abuse, it might be wise to recommend very ... >I heard of a guy who's immediate boss (the company boss's son) thought all ... I prefer very flat programs controlled by conditional GOTOs (or JMPs, ...
    (sci.electronics.design)