Curious about function prototypes...

Devin_E_Ben-Hur at cup.portal.com Devin_E_Ben-Hur at cup.portal.com
Wed Jun 15 10:43:43 AEST 1988


Someone asked about how to use the pre-processor to support pre-dpANS
function definitions.  Try this (admittedly ugly) scheme:

#ifdef __STDC__

#define _PROTO1_(t1,a1)	(t1 a1)
#define _FNCDF1_(t1,a1)	(t1 a1)
#define _PROTO2_(t1,a1,t2,a2)	(t1 a1, t2 a2)
#define _FNCDF2_(t1,a1,t2,a2)	(t1 a1, t2 a2)
/* ... _xxxxxN_ */

#else

#define _PROTO1_(t1,a1)	()
#define _FNCDF1_(t1,a1)	(a1) t1 a1;
#define _PROTO2_(t1,a1,t2,a2)	()
#define _FNCDF2_(t1,a1,t2,a2)	(a1,a2) t1 a1; t2 a2;
/* ... _xxxxxN_ */

#endif

extern int foo _PROTO2_(int,an_integer, char *,a_char_ptr);

int foo _FNCDF2_(int,an_integer, char *,a_char_ptr)
{ /* ... */ }



More information about the Comp.lang.c mailing list