-Wstrict-prototypes

Robert STRANDH (Robert.Strandh@labri.u-bordeaux.fr)
Wed, 11 Dec 1996 16:26:53 +0100 (MET)

As I have pointed out before, there is a problem whith using the SCM_P
macro the way it is currently done.

For instance, if you compile the following file

int
f(a, b)
int a; float b;
{
return a * b;
}

int
g(x)
char *x;
{
f(x, x);
}

Even though there is a type error, it is not caught by the compiler.
Simply forgetting the prototype makes this error go unnoticed. I
should have written:

int f SCM_P((int a, float b));

int
f(a, b)
int a; float b;
{
return a * b;
}

int g SCM_P((char *x));

int
g(x)
char *x;
{
f(x, x);
}

In order to catch either the forgotten prototype or the type error,
I should compile with -Wstrict-prototypes. If Guile is not
systematically compiled with -Wstrict-prototypes, we might as well not
have prototypes at all, as we can't count on the the compiler to warn
us of argument mismatches.

-- 
Robert Strandh

--------------------------------------------------------------------- Greenspun's Tenth Rule of Programming: any sufficiently complicated C or Fortran program contains an ad hoc informally-specified bug-ridden slow implementation of half of Common Lisp. ---------------------------------------------------------------------