Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!wjh12!talcott!harvard!seismo!umcp-cs!chris
From: chris@umcp-cs.UUCP (Chris Torek)
Newsgroups: net.lang.c
Subject: Re: declaring routines which return function pointers
Message-ID: <1957@umcp-cs.UUCP>
Date: Mon, 17-Dec-84 06:58:54 EST
Article-I.D.: umcp-cs.1957
Posted: Mon Dec 17 06:58:54 1984
Date-Received: Tue, 18-Dec-84 07:04:32 EST
References: <249@alberta.UUCP> <423@gitpyr.UUCP>
Distribution: net
Organization: U of Maryland, Computer Science Dept., College Park, MD
Lines: 41

> > 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 played around with the code for about 30 minutes and the only thing I
> accomplished was to make lint core dump twice.

Oh good grief!  Try

	int (*f)();
	int fb();
	int (*fa())();

	int (*fa())() {
		f = fb;
		return f;
	}

	fb() {
	}
-- 
(This line accidently left nonblank.)

In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (301) 454-7690
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland