Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!crdgw1!kirkwood.crd.ge.com!doel From: doel@kirkwood.crd.ge.com Newsgroups: comp.lang.c Subject: ANSI/K&R functions in same source Message-ID: <15895@crdgw1.crd.ge.com> Date: 21 Jan 91 14:33:41 GMT Sender: news@crdgw1.crd.ge.com Reply-To: doel@kirkwood.crd.ge.com () Distribution: usa Organization: General Electric Corp. R&D, Schenectady, NY Lines: 39 Hi, I imagine this type of thing has been discussed before, so I apologize for any repitition. I write most of my code on a PC using an ANSI compiler. One of the biggest plusses of ANSI is of course, the function prototypes. However, I also like to use some of the tools available (e.g. lint) on Unix boxes that don't know about prototypes (when will this change?). I have been writing code in the following manner: in my_decl.h ------------- #ifdef __STDC__ void func1(int arg1, double arg2); char *func2(char *arg3); #else void func1(); char *func2(); #endif in my_code.c ------------ #ifdef __STDC__ void func1(int arg1, double arg2) #else void func1(arg1,arg2) int arg1; double arg2; #endif etc... While this works (i.e. I don't have to run some ansi-to-k&r filter or vice versa), I imagine that there is a more elegant solution. Is there a clean way to write functions which can be compiled immedaitely on ANSI & KR compilers while retaining function prototypes on the ANSI compilers? Thanks in advance Mike