problems/risks due to programming language
William Thomas Wolfe, 2847
billwolf%hazel.cs.clemson.edu at hubcap.clemson.edu
Thu Feb 22 12:45:25 AEST 1990
>From jnixon at andrew.ATL.GE.COM (John F Nixon):
>> This is not a valid analogy. In C, the case statement *requires* the
>> use of a restricted GOTO in order to accomplish "normal" processing;
>
> But we aren't talking about using the "break" in this sense, we are talking
> about using the "break" to exit an "if", something which isn't C.
We are talking about using a restricted GOTO to exit a control structure
in a normal situation. The fact that one type of C control structure
requires use of a GOTO for normal exit and another type of C control
structure does not is a source of inconsistency and potential confusion.
>> In other words, C requires use [of] a dangerous construct on a routine basis.
>
> Just as Ada requires the use of "exit" to leave the "loop" construct;
> unless you use Ada'a "goto"...
Not true; the bare "loop...end loop" is used in situations in which
the intention is for the loop to execute forever. This arises in
embedded controllers, operating systems, and similar applications.
If one is not writing such applications, then "while (Condition) loop"
and "for Control_Variable in Start..Finish loop" are normally applied.
By requiring the use of a GOTO during normal processing (as C does
with its switch..break system), C encourages its programmers to get
into the habit of using its restricted GOTO routinely. As AT&T has
recently discovered, that can easily prove to be an expensive habit.
Bill Wolfe, wtwolfe at hubcap.clemson.edu
More information about the Comp.lang.c
mailing list