Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site harvard.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!steve From: steve@harvard.UUCP ( Pratap) Newsgroups: net.lang.c Subject: ANSI C and function prototypes Message-ID: <681@harvard.UUCP> Date: Tue, 4-Feb-86 15:01:19 EST Article-I.D.: harvard.681 Posted: Tue Feb 4 15:01:19 1986 Date-Received: Thu, 6-Feb-86 05:15:28 EST Reply-To: steve@harvard.UUCP (Kaufer - Lopez - Pratap) Organization: Aiken Comp Lab, Harvard Lines: 29 Here is a short question regarding the new ANSI standard and function prototypes. Let's say I want to write a 'dispatcher' routine that is passed a code number and a pointer to a function to call. I wish to use a prototype to make sure that I am always passing two arguments, the first of which is an int and the second of which is a function pointer. I might define the prototype as: dispatcher(int code, void (*disp_func)()); My problem is that under the standard it will always be an error to call this routine with a pointer to a function that does NOT return void. Is there any way to prototype the second argument as a pointer to a function returning 'anything'? I realize if I prototype the second argument as a 'void *pointer', any pointer will be properly converted, but this defeats my purpose of checking to make sure that the second argument is really a function pointer. I can think of many times when I have passed pointers to functions that return various different types, yet I see no way of doing this when using prototypes. Steve Kaufer steve@harvard.HARVARD.EDU {seismo,ihnp4,allegra,ut-sally}!harvard!steve