T
Tim Rentsch
Keith Thompson said:I agree that that was probably the intent. The real problem is that
7.19.6.1p9 uses the phrase "*the* correct type", strongly implying
that there's only one such type.
Certainly it could be read that way. It seems more likely IMO
that it was just an oversight or poor wording choice, but I
admit that existing wording does raise questions.
I think this is an error in the standard, which should be corrected
by replacing the phrase "the correct type" with a reference to
7.15.1.1p2.
I agree.
As it is, the standard doesn't actually say that the printf()
and friends use <stdarg.h> to process their arguments, so it's not
clear that anything in 7.15 is applicable. (Except that printf
can be called via a pointer, so a given call could randomly be
either to printf or to some function that does use <stdarg.h>.)
I agree the point can be argued. What I was trying to say in
my earlier comments is that, of the different possibilities
availble for what "the correct type" means, 7.15 seems to me
to be the most natural. For that matter any library function,
not just those with variadic arguments, may be defined in
something other than C. We expect those functions to conform
to the same requirements for function calls that regular
functions do, even though the preconditions for that conclusion
may not literally apply. It seems unlikely that this property
of behaving like other regular C functions would be different
between the two cases without being stated explicitly. In
fact, thinking about this prompted me to re-read 7.1.4 "Use of
library functions", which says (in part):
If an argument to a function has an invalid value ...
or a type (after promotion) not expected by a function
with variable number of arguments, the behavior is
undefined.
Since the statements in 7.1.4 apply to all library functions
unless explicitly stated otherwise, doesn't it seem like "the
correct type" is meant to reference this statement, and hence
the conditions given in 7.15.1.1?