Curious about function prototypes...

Gunars V. Lucans gunars at spsspyr.UUCP
Tue Jun 14 06:46:51 AEST 1988


In article <8073 at brl-smoke.ARPA> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
> ... New code should consistently use prototype style for both declarations 
>and definitions.

Can anyone suggest how to code new style prototype definitions in a manner 
that would be portable to older compilers?  For declarations, the following 
would suffice (from T.Plum's "Reliable Data Structures in C"):
	
	#ifdef PROTO_OK
	#define PARMS(x) x
	#else
	#define PARMS(x) ()
	#endif

	void foo PARMS( (int arg1, char *arg2) );
	
Definitions are another matter.  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)
	{
		<body>
	}

What is the general level of compliance to the proposed standard in existing
UNIX compilers?  How soon can we expect the majority of them to be ANSI
conforming, given that the market for UNIX compilers is different than that
for MS-DOS compilers?
____________________________________________________________________________
 Gunars V. Lucans  --  SPSS Inc, Chicago  --  ...!att!chinet!spsspyr!gunars
-- 
____________________________________________________________________________
 Gunars V. Lucans  --  SPSS Inc, Chicago  --  ...!att!chinet!spsspyr!gunars



More information about the Comp.lang.c mailing list