Re: If you were inventing CoBOL...
From: Michael Wojcik (mwojcik_at_newsguy.com)
Date: 09/07/04
- Next message: docdwarf_at_panix.com: "Re: Revisiting an Old Prejudice: READ INTO/WRITE FROM"
- Previous message: sbelt_at_dpcsystems.com: "Is a General File Maintenance Routine possible?"
- In reply to: Robert Wagner: "Re: If you were inventing CoBOL..."
- Next in thread: LX-i: "Re: If you were inventing CoBOL..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 7 Sep 2004 14:38:16 GMT
In article <b7djj0dcl5pb7prmim2ditf36eiplr8ftq@4ax.com>, Robert Wagner <robert@wagner.net.yourmammaharvests> writes:
>
> Whoops. I should have said EXIT EVALUATE. There's no such thing. I
> made it up to compare with C, which requires an explicit exit
> 'break'. If you leave it out, the case statement continues running.
> Missing 'break' is a common form of bug.
>
> Some defend that, saying you might want it to continue if the program
> is a 'state machine'.
State machines have nothing whatsoever to do with it.
Default fallthrough was a deliberate design decision by Dennis
Ritchie, but it was made primarily to simplify implementing something
that clearly is a feature: multiple cases with a common body, as in
case 1:
case 2:
action();
break;
Some subsequent C-like languages that have removed default fall-
through (C#, for example) treat empty case bodies specially, so only
they fall through; that permits multiple case syntax while removing
the problem of accidental fallthrough. (C# overloads the goto
keyword for explicit fallthrough - unnecessary, since a normal C goto
with a normal label would also work, but a bit of syntactic sugar to
pacify fallthrough fans.)
That is clearly an improvement in language safety, but it complicates
implementation. It also arguably muddies the language design, though
since case is already a distinct C construct (basically a block-scoped
goto) another idiosyncracy hardly seems to matter.
-- Michael Wojcik michael.wojcik@microfocus.com Today's Carnivore bait: Distracted by the Anthrax song, I let my bin, laden with goods, crash into a bush.
- Next message: docdwarf_at_panix.com: "Re: Revisiting an Old Prejudice: READ INTO/WRITE FROM"
- Previous message: sbelt_at_dpcsystems.com: "Is a General File Maintenance Routine possible?"
- In reply to: Robert Wagner: "Re: If you were inventing CoBOL..."
- Next in thread: LX-i: "Re: If you were inventing CoBOL..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|