gripe: variable arg lists

Chris Torek chris at umcp-cs.UUCP
Sat Nov 17 12:01:41 AEST 1984


There are times when it is important to be able to get at the innards
of printf (i.e., _doprnt or _printf or _foobar or whatever the XYZ
software co. calls it), because the existing functions just don't Do
What You Want.  There is a wonderfully nearly portable way to do this,
and that is the v*printf routines in System V.  Sigh.

Even those may not Do What You Want.  Probably the most general way
to do things would be to have a routine called func_printf, which
takes a function $f$, an argument $caddr_t arg$, a format $fmt$, and
a variable argument list a la printf and friends.  Then the routine
that actually implements printf() et al. could call $f$, giving the
character to be printed and the extra $arg$.  If $caddr_t$ is the
generic pointer type, you can then squeeze all needed info into a
structure and pass its address.

Of course, such an implementation would be terribly inefficient for
ordinary stdio file I/O...

In the meantime, I've got #ifdef pyr's in my Emacs source.  Sigh.
-- 
(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 at umcp-cs		ARPA:	chris at maryland



More information about the Comp.lang.c mailing list