ANSI C prototypes
Paul Flinders <FlindersPT>
ptf at cs.bham.ac.uk
Tue Oct 30 07:54:02 AEST 1990
Can anbody suggest an elegant solution to the following.
given the file foo.c which contains code for a module within a program,
foo.h which defines prototypes for routines in foo.c and bar.c which
includes foo.h I tend to include foo.h in foo.c so that the compiler
will tell me if I have been foolish enough to change a routines
parameters without changing foo.c (the code in foo.c is not yet cast
in stone so changes are a posibility). This works fine _except_ for
varargs functions eg.
in foo.h:
extern void ddprintf(const char *fmt, ...);
BUT in foo.c:
void ddprintf(va_alist)
va_dcl;
this causes problems. The only solution that I've thought of is to
define some preprocessor token in foo.c _before_ the include of foo.h
and then #ifdef the extern declaration out. This seems a little messy
though. Anybody else have any solutions to this.
Paul Flinders | "It is bad luck to be superstitious."
FlindersPT at cs.bham.ac.uk | -- Andrew W. Mathis
More information about the Comp.lang.c
mailing list