print hex value of char

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?
 
K

Keith Thompson

Tim Rentsch said:
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.

What seems more likely than what? I think we're in agreement that
the phrase "the correct type" was just an oversight. The fact
that the current wording implies a single type is the result of
that oversight.

[snip]
 
T

Tim Rentsch

Keith Thompson said:
What seems more likely than what? I think we're in agreement that
the phrase "the correct type" was just an oversight. The fact
that the current wording implies a single type is the result of
that oversight.

More likely that the phrasing was the result of an oversight
than that "the" was deliberately chosen to mean "exactly
one". If the phrasing was chosen inadvertently rather
than deliberately then I think I would say there isn't
any implication about being a single type. Anyway
sorry for the confusion, my sentence was poorly worded.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top