Path: utzoo!attcan!uunet!world!decwrl!lll-winken!elroy.jpl.nasa.gov!jpl-devvax!david From: david@jpl-devvax.JPL.NASA.GOV (David E. Smyth) Newsgroups: comp.lang.c Subject: Func Protos with K&R Func Defs Message-ID: <11614@jpl-devvax.JPL.NASA.GOV> Date: 28 Feb 91 01:11:10 GMT Reply-To: david@jpl-devvax.JPL.NASA.GOV (David E. Smyth) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 43 I do this all the time: in WcCreate.h: #ifdef _FUNCTION_PROTOTYPES ... extern void WcWidgetCreation ( Widget root ); ... #else ... extern void WcWidgetCreation(); ... #endif in WcCreate.c: void WcWidgetCreation ( root ) Widget root; { ... } This seems like the easiest way to use prototyped function declatations when your compiler supports it, and K&R function definitions in any case. Then only the *.h files need to have #ifdef's. Then "gcc -ansi -D_FUNCTION_PROTOTYPES" still does return type and argument checking across function calls, as long as it sees the prototyped function declaration before it is used somewhere. And "cc" still does little or no checking... Does anybody have any problems with this on their compilers? ------------------------------------------------------------------------- David Smyth david@jpl-devvax.jpl.nasa.gov Senior Software Engineer, seismo!cit-vax!jpl-devvax!david X and Object Guru. (818)393-0983 Jet Propulsion Lab, M/S 230-103, 4800 Oak Grove Drive, Pasadena, CA 91109 ------------------------------------------------------------------------- One of these days I'm gonna learn: Everytime I throw money at a problem to make it disappear, the only thing that disappears is my money... -------------------------------------------------------------------------