"%d"+1 and printf !!

P

Phil Carmody

rio said:
for the printf(fmt, ...)
from fmt printf know how many argument it should have

Should's are worthless. It does not know how many arguments
it *does* have.

Phil
 
D

Dik T. Winter

>
> for the printf(fmt, ...)
> from fmt printf know how many argument it should have

Yes, it does know how many it *should* have, it does not know how many it
*does* have. (Although Han kindly informed me that there are systems where
printf also does know that. I should have known because I have used
systems where a routine could detect the number of arguments supplied, but
that is outside the standard.)
 
C

CBFalconer

Dik T. Winter said:
.... snip ...

Yes, it does know how many it *should* have, it does not know how
many it *does* have. (Although Han kindly informed me that there
are systems where printf also does know that. I should have known
because I have used systems where a routine could detect the
number of arguments supplied, but that is outside the standard.)

Han is wrong. Any such system is not C, in that you cannot count
on the facility existing.
 
J

James Kuyper

CBFalconer said:
Han is wrong. Any such system is not C, in that you cannot count
on the facility existing.

A fully conforming C system could provide such a facility. It is the
code that makes use of such facilities that is not strictly conforming C
code.
 

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

Similar Threads

%a in printf 6
Why do i get runtime error ? 19
Strange behaviour of while loop !! 14
For loop and strlen 8
++*p++ 24
Command Line Arguments 0
A different kind of subtraction ? 5
sequence points and printf() 17

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top