Path: utzoo!attcan!uunet!husc6!uwvax!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Curious about function prototypes... Message-ID: <11956@mimsy.UUCP> Date: 14 Jun 88 03:42:30 GMT References: <654@orion.cf.uci.edu> <8073@brl-smoke.ARPA> <273@spsspyr.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 64 In article <273@spsspyr.UUCP> gunars@spsspyr.UUCP (Gunars V. Lucans) writes: >... For declarations, the following would suffice (from T.Plum's ... >[magic PARMS macro] > void foo PARMS( (int arg1, char *arg2) ); I use something like this already (although I used /* * A rather ugly way to hide prototypes from the old compiler. */ #ifndef _PROTO_ #if defined(__STDC__) || defined(c_plusplus) || defined(__cplusplus) #define _PROTO_(x) x #else #define _PROTO_(x) () #endif #endif int isalpha _PROTO_((int _c)); etc.). >Definitions are another matter. Indeed. >Is there an alternative (other than not using prototypes at all) to: > > void foo ( > #ifdef PROTO_OK > int > #endif > arg1, > #ifdef PROTO_OK > char * > #endif > arg2) > { > > } This is missing one section: #ifndef PROTO_OK int arg1; char *arg2; #endif I think I prefer #ifdef PROTO_OK void foo(int arg1, char *arg2) #else void foo(arg1, arg2) int arg1; char *arg2; #endif { even if it does name everything twice (or three times!). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris