Re: change variables




Michael Wojcik wrote:

In COBOL, true, but not in C, where the scope of a label is the
enclosing function.

That's probably true but I never needed to know that having never used
goto in C.

Obviously that doesn't help when we wish to read a program that *does*
abuse GO TO, but then neither does proscribing it.

The problem is knowing whether it does abuse GO TO or not, and whether
that is deliberate or accidental. If there _is_ a GO TO anywhere then
one has to check that there is no abuse.

It is similar to when there was an ALTER in the program. No GO TO could
ever be trusted until the whole program was checked, and then those
paragraphs referenced could never be trusted at any time.

Get rid of the ALTER and days of checking just disappears, those checks
are just not needed anymore. Get rid of GO TO, SECTION, THRU, and EXIT
...., and another chunk of code checking is just not needed.

I do agree that a mechanism for restricting the scope of labels to
something smaller than a program would be useful.

Not only the scope but also the usage. In C a function cannot be
dropped into, it can only be executed, a label can only be the target
of a goto (implied in a switch). If labels could be designated as only
a target of perform (no drop thru or goto) or only the target of a goto
(no drop thru or perform) then many types of errors could be found by
the compiler.

.



Relevant Pages

  • 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 prefer very flat programs controlled by conditional GOTOs (or JMPs, ... I prefer to use CASE like statements to implement state machines. ...
    (sci.electronics.design)
  • 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)
  • Re: a goto command???
    ... but is very easy to abuse. ... > I think you will find that those people who oppose the goto sometimes ... > it makes bad code easy to write. ... MATLAB FAQ: http://www.mit.edu/~pwb/cssm/ ...
    (comp.soft-sys.matlab)
  • Re: a goto command???
    ... >> A goto command, used sparingly and properly, can help simplify ... but is very easy to abuse. ... >> I think you will find that those people who oppose the goto sometimes ... I hope it's clear that I agree with you that goto is not always evil. ...
    (comp.soft-sys.matlab)
  • RE: Can Worksheet_Change call itself?
    ... After execution of the E16 target, it would come back to the ... ) Is Nothing Then GoTo 20 ... "Brad E." ... in other words leave the value of that cell the same ...
    (microsoft.public.excel.programming)