problems/risks due to programming language
B. S. Oplinger
oplinger at proton.crd.ge.com
Sat Feb 24 05:55:58 AEST 1990
Consider the following (slightly modified from the example by Scott MacHaffie):
example:
switch (x) { /* x is a character, for example */
case '0':
number_of_groups ++;
case '1': ... case '9':
print_digit(x);
break;
case 'a': ... case 'z':
print_lowercase(x);
break;
}
In my example, 0 is just like any other number except that it signals
the start of a new group, hence the increment on the number-of-groups
counter. This is just the problem with the syntax of the C case
(switch) statement. It is designed so that a case may do some work and
then 'share' the work of the following case statement. I will submit
that this general attitude is found throughout C. Ada, although not a
perfect language, is almost always presented with some discussion on
software-engineering. I feel that this help promote good work habits.
On LINT, I would never program without it (in C). There is no excuse
for today's language running on todays machines (hell, even the PC)
that LINT checking cannot be done during a compile. I believe that it
should also be an option that must be turned off, not on.
various random thoughts from:
brian
oplinger at crd.ge.com
<#include standard.disclaimer>
More information about the Comp.lang.c
mailing list