problems/risks due to programming language, stories requested
Michael D Mellinger
melling at cs.psu.edu
Thu Mar 1 11:55:44 AEST 1990
In article <31039 at brunix.UUCP> phg at cs.brown.edu (Peter H. Golde) writes:
The C language might be made "simpler" if all
undeclared variable were automatically declared
as auto int; thus saving the need for "useless" declarations. I would
not like to program in such a language, would you?
To take a more "real-life" example, I have, at times, mis-typed
a C program as follows:
c = foo(d); /* update count of flibbets *
bam_whiz(c, d); /* and propagate change to zip module */
return;
If I had used another language, this error would have been caught by
the compiler. Clearly this is a small point, but it illustrates
my point: some languages and compilers permit a larger percentage
of minor errors to pass than others.
--Peter Golde
Some compilers will warn you if you have nested comments. gcc, for example,
will warn you about this if you use the -Wcomment option. But your point
is well taken. Personally, it's the little things like this that make me
believe that everyone should ABANDON C and move on to C++(two others being
function prototyping and strong type checking). Waddya think? Wither C?
void count_flibbets(int d)
// int d; Stop doing this!!
{
c = foo(d); // update count of flibbets
bam_whiz(c, d); // and propagate change to zip module
return;
}
-Mike
More information about the Comp.lang.c
mailing list