problems/risks due to programming language
Scott MacHaffie
machaffi at fred.cs.washington.edu
Fri Feb 23 17:46:25 AEST 1990
In article <8126 at hubcap.clemson.edu% billwolf%hazel.cs.clemson.edu at hubcap.clemson.edu writes:
%From machaffi at fred.cs.washington.edu (Scott MacHaffie):
%% No, it is necessary to use a statement to indicate that the current case
%% statement is finished...like an "end case" or the next "when =% " in ADA.
%
% Such a statement already exists: either the next "case Value:", or
% the } which ends the switch. Why is it necessary to use a "break"?
example:
switch (x) { /* x is a character, for example */
case '0': case '1': ... case '9':
print_digit(x);
break;
case 'a': ... case 'z':
print_lowercase(x);
break;
}
The semantics of a C switch/case statement are different than the semantics
of an ada case/when.
% The problem cannot simply be defined out of existence by saying,
% in essence, that good programmers don't make mistakes. All human
% programmers make mistakes, and a well-designed language will help
% to minimize this particular tendency. In this case, C does not.
Good programmers understand the language they are using -- good programmers
are literate. No language can eliminate errors. Good software engineering
practices should be used to (try to) catch language-specific errors.
%%% This is certainly true; Brooks and others have noted that the good
%%% software engineering practices which are routinely introduced in
%%% conjunction with the Ada language are responsible for more of the
%%% resulting improvements than the fact that the Ada language was
%%
%% Well, these practices are certainly NOT being introduced in the
%% universities (at least not here).
%
% In that case, I strongly suggest that you immediately bring
% this fact to the attention of the software engineering faculty
% at washington.edu. At other universities (e.g., Clemson), Ada
% *is* introduced in conjunction with software engineering.
Software engineering faculty? I wish. None of the undergraduate classes
here touch software engineering, and I think at most one of the graduate
classes does. Anyone who wants to be a software engineer here has to
pick it up from other sources.
Scott MacHaffie
More information about the Comp.lang.c
mailing list