declaring routines which return function pointers

Howard Johnson howard at cyb-eng.UUCP
Wed Dec 19 04:06:19 AEST 1984


> I have a routine which resembles the following:
> 
> 	int (*f)();
> 	int fa(), fb();
> 
> 	fa() {
> 		f = fb;
> 		return(f);
> 	}
> 
> 	fb() {
> 	}
> 
> The problem with the above is that lint complains about an illegal combin-
> ation of a pointer with an integer in the 'return' statement.  I have tried
> various casts and function declarations to try to satisfy lint, but none of
> them have worked.  Does anybody know what I should do to keep lint happy?

I thought more people knew the answer to this one.  On our Unisoft System V
system, the signal system call looks something like this:

	int (*signal(sig, func))()
	int (*func)();
	{
		static int (*oldsig)();

		/* code */;
		return(oldsig);
	}
-- 
	Howard Johnson		Cyb Systems, Austin, TX
..!{gatech,harvard,ihnp4,nbires,noao,seismo}!ut-sally!cyb-eng!howard



More information about the Comp.lang.c mailing list