%r, and why it disappeared (a theory)

Sam Kendall kendall at wjh12.UUCP
Thu Oct 13 16:18:14 AEST 1983


As previously noted, %r takes as argument a char **, which is a pointer
to a bunch of printf-style arguments, starting with a format string, on
the stack.  So %r can be used to write functions which take printf-like
variable argument lists, and call printf to print them.  THIS IS
OTHERWISE IMPOSSIBLE, without either (1) rewriting printf and including
the code in your function, or (2) calling _doprnt, the undocumented
function shared by all printf and [sf]printf.  (By the way, there was
once an article on the net on how to use _dorpnt for this purpose.  Maybe
it should be re-submitted.)

So %r is really useful.  It was documented in PWB, if I remember
correctly (can anyone check me there?); but why was it subsequently
un-documented, and then removed?  Well, the problem with %r is that it
CANNOT be implemented on one system, GCOS (a Honeywell somethingorother).
Maybe it was removed from USG UNIX because USG wants their UNIX to be
portable, even to GCOS.  On the other hand, perhaps it was just
un-documented accidentally, and then removed because it was
undocumented.

But it is (was) so useful!  And it could be respecified to be portable
using the usually undocumented varargs(3) package.  I am told that
Andrew Koenig (sp?) is the author both of the varargs(3) package and of
the System III printf.  Perhaps he can shed some light on this.  Can
someone ask him?

	Sam Kendall		  {allegra,ihnp4}!wjh12!kendall
	Delft Consulting Corp.	    decvax!genrad!wjh12!kendall



More information about the Comp.lang.c mailing list