need info: %r in printf

Jerry Leichter leichter at yale-com.UUCP
Wed Oct 12 23:45:42 AEST 1983

"%r" is "Remote Format" in DECUS C; I don't know whether any other C's support
it.  Here is the relevant documentation from the DECUS C manual:

	Remote Format.  The next printf() argument is the format.  Note that
	this is not a subroutine.  The current format is not processed
	further.  For example:

			error("Error at %r",&args);

	This routine might be called as follows:

		bug("Error %d at %s\n",val,name);

Note:  error() in DECUS C takes a printf-like argument, prints it to stderr,
then exits.  The use of "&args" is a standard hack for passing on multiple

There is no general equivalent for %r that I know of.  You can probably get
some of the effect using the variable-number-of-arguments package.  In some
cases, you'll have to re-organize the code, perhaps to do multiple sprintf's.

BTW, the example above is rather silly, since the "bug" call shown will produce
a message of the form "Error at Error xxx at yyy".  However, the idea should
be clear...The only examples of %r I know of, as it happens, are in error
printers of this general form; in fact, I think error() itself may use %r
to call fprintf.
							-- Jerry
					decvax!yale-comix!leichter leichter at yale

More information about the Comp.lang.c mailing list