varargs question

Brian Renaud bdr at neti1.uucp
Thu Jul 14 02:56:42 AEST 1988


I am writing a function which, ideally, would take an optional
argument which would be a pointer to a function which returns a
pointer to a char.  I am using a non-ansi <varargs.h> type compiler.
My code looks something like:

	...
	char	*(*func)();	/* local variable to hold pointer */
	...
	func = va_arg(ap, char *(*)());

Unfortunately, va_arg turns the cast into something like:

	(char *(*)() *) ...

instead of the desired:

	(char *(**)() ) ...

Am I (quite likely) just making a dumb error here?  If not, is there
some portable workaround to deal with this?

-- 
Brian Renaud      bdr%huron.uucp at umix.cc.umich.edu
Huron Systems     {umix,neti2}!huron!bdr



More information about the Comp.lang.c mailing list