need info: %r in printf
Henry Spencer
henry at utzoo.UUCP
Fri Oct 14 06:03:23 AEST 1983
The reason (well, I think the major reason) why %r has gone away in
recent years is that it is not really portable. The trick of calling
a routine with a variable number of parameters, while the routine
declares only one parameter and invokes printf %r with the address
of that parameter, is nifty and neat but absolutely requires some
highly machine-dependent assumptions about calling sequences. There
is no truly machine-independent way to do this trick without help from
the language, help which C does not provide. The only thing you can
really do about it is to sprintf into a string and then pass that.
(Yes, I know, it's not as convenient.)
Please, no questions about why a machine-dependent construct like this
is in DECUS C. Either they didn't know what they were doing, or they
didn't care (anyone using a DEC operating system obviously isn't worried
about portability anyway, right?).
--
Henry Spencer @ U of Toronto Zoology
{allegra,ihnp4,linus,decvax}!utzoo!henry
More information about the Comp.lang.c
mailing list