"Rajesh S R" <SR**********@g mail.comwrites:
printf("%hhd",8 9);/*Assume char has 8 bits and is signed*/
Is it valid?
I know that it has been discussed in comp.std.c.
http://groups.google.co.in/group/com...941cbf/?hl=en#
Readers in the US should probably use "groups.google. com" rather than
"groups.google. co.in".
But I want to know what was the conclusion that has been reached. It
is unusually long with 146 posts. Therefore it is hard to follow the
whole discussion.
Therefore I request the authors and those who followed the discussion
to summarize the conclusion that was reached so that it can be of some
help to the programmers.
(I started that thread.)
I'm not sure that any firm conclusion was reached. As a practical
matter, it's going to work in any reasonable implementation. The
problem, I think, is that the standard says printf and friends are
variadic functions, but it doesn't actually say that they work the
same way as a function written in C using <stdarg.h>. It's reasonable
to assume that they do, but the standard doesn't explicitly say so.
As you say, it was a very long thread, and since it was several months
ago I don't remember everything that was discussed. The only real way
to determine whether a consensus was reached would be to read the
thread itself.
Also, note that the thread was in comp.std.c, not comp.lang.c, so I'm
not sure why you posted here. On the other hand, posting their most
likely either (a) wouldn't give you a definitive answer, or (b) would
spawn a lengthy thread rehashing the same arguments, possibly both.
The standard's wording is not 100% precise. The question, I suppose,
is how precise it really needs to be. It's been argued that the
wording of the standard has to be interpreted on the basis of common
sense; the problem is that not everybody's common sense is the same.
--
Keith Thompson (The_Other_Keit h)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"