Xref: utzoo comp.lang.c:23457 comp.lang.c++:5299 comp.std.c:1985 Path: utzoo!attcan!utgpu!utstat!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!wuarchive!wugate!uunet!crdgw1!crdos1!davidsen From: davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) Newsgroups: comp.lang.c,comp.lang.c++,comp.std.c Subject: Re: Automatic converters (K&R C => ANSI C) (K&R C => C++) (ANSI C => K&R C) Message-ID: <1516@crdos1.crd.ge.COM> Date: 30 Oct 89 15:06:01 GMT References: <1989Oct22.113105.29034@paris.ics.uci.edu> <1004@cirrusl.UUCP> <1989Oct27.190150.22043@paris.ics.uci.edu> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Followup-To: comp.lang.c Organization: GE Corp R&D Center Lines: 32 In article <1989Oct27.190150.22043@paris.ics.uci.edu>, rfg@ics.uci.edu (Ron Guilmette) writes: | >and produces: | > | > #ifdef ANSIPROTO | > int xyz(char *c, FILE *f); | > #else | > int xyz(); | > #endif I might suggest that this could make for large and possibly hard to read code, and that it have the declarations in two places, with the possibility that future editing will add/delete/change only one. I offer the following suggestion which some people may find useful. Define a macro: #ifdef ANSIPROTO #define PARAM(x) x else /* old style */ #define PARAM(x) () #endif /* meaning of PARAM */ Then you can say (note two levels of parens): extern lsf PARAM((int, int, int*)); This results in only one line for the prototype, and is still pretty readable. You can include names or just types as you please. -- bill davidsen (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen) "The world is filled with fools. They blindly follow their so-called 'reason' in the face of the church and common sense. Any fool can see that the world is flat!" - anon