Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c Subject: Re: ANSI C prototypes Message-ID: <494@taumet.com> Date: 30 Oct 90 16:06:03 GMT References: <1005@christopher-robin.cs.bham.ac.uk> Organization: Taumetric Corporation, San Diego Lines: 38 ptf@cs.bham.ac.uk (Paul Flinders ) writes: >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. As well it should. What you show is not ANSI C, despite the Subject line of your posting. It is the BSD C approach to variadic functions, which is not quite the same as the ANSI approach. In ANSI C, void ddprintf(const char *fmt, ...); and void ddprintf(va_alist); are not at all the same. It sounds like you are using with an ANSI compiler, instead of using . If you use the ANSI C header, the function delcaration in foo.h and the function defintion in foo.c become identical. But you need to decide if the function is to take a variable *list* of arguments, or *one* argument of type va_list. The two notions are not the same. Refer to the discussions of , printf() and vprint() in any good ANSI C text, or in the Standard, for more details. -- Steve Clamage, TauMetric Corp, steve@taumet.com