From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!crdgw1!sunroof!hammondr From: hammondr@sunroof.crd.ge.com (Richard A Hammond) Newsgroups: comp.lang.ada Subject: Re: problems/risks due to programming language Message-ID: <5453@crdgw1.crd.ge.com> Date: 21 Feb 90 22:49:10 GMT References: <5432@crdgw1.crd.ge.com> <8103@hubcap.clemson.edu> Sender: news@crdgw1.crd.ge.com Organization: General Electric Corporate R&D Center List-Id: In article <8103@hubcap.clemson.edu> billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu writes: ... > This is not a valid analogy. In C, the case statement *requires* the > use of a restricted GOTO in order to accomplish "normal" processing; ... > With the if construct in C, the default is to exit the if construct > automatically, as opposed to continuing on to execute the section of > code associated with the else part. Thus, we have an inconsistency > in C's design: with one flow-of-control construct (the switch), it is > necessary to use a dangerous GOTO to achieve normal processing, whereas > with a similar flow-of-control construct (the if-else), the default is > reversed. Given such a language design, it should not surprise anyone > that programmers become confused, particularly when the constructs are > being used together. Bull!!! I've seen lots of errors in C code, and this is the first time I've seen or heard of such an error. If it really was all that confusing, I'd expect to have seen it much more frequently. In fact, the structures are quite different, since a case in a switch has a sequence of statements without any additional brackets, whereas an if statement controls only a single statement, so it is usually followed by "{" and "}" to bracket multiple statements. I expect it was an editing error that pulled the "break" inside the if, rather than leaving it at the end of the case. If that is true, then the same error could be made in Ada, it certainly is not PREVENTED in Ada. As the anti-nuclear protesters will gladly explain, 0 risk and a reduced risk are not the same!!!! > ... C, on the other hand, was designed to provide > maximal support for the compilation process. Where did you get this idea? I believe a better statement is found in AT&T Bell Laboratories Technical Journal, Vol 63, No 8, Part 2, pg 1686, Oct. 1984 "A major trend in the development of C is toward stricter type checking, along the lines of languages like Pascal. However, in accordance with what has been called the "spirit" of C (meaning a model of computation that is close to that of the underlying hardware), many areas of the language specification deliberately remain permissive." This does not imply that it was meant to support the compilation process, but rather, that without huge runtime libraries I could run something through a C compiler and execute it on a bare machine. Rich Hammond