Paul Edwards said:
<snip>
What happens is that by default, C "guesses" that any function
you use that doesn't have a prototype is a function that takes a
variable number of arguments and returns an int.
Not true in C90.
"If the expression that precedes the parenthesized argument list in a
function call consists solely of an identifier, and if no declaration
is visible for this identifier, the identifier is implicitly declared
exactly as if, in the innermost block containing the function call, the
declaration
extern int identifier();
appeared."
This is /not/ a function that takes a variable number of arguments, but
a function that takes an unknown number of arguments.
If you call a function that takes a variable number of arguments,
without a valid prototype in scope, the behaviour is undefined:
"If the function[1] is defined with a type that includes a prototype,
and the types of the arguments after promotion are not compatible with
the types of the parameters, or if the prototype ends with an ellipsis
( ", ..." ), the behavior is undefined."
[1] In context, this refers to a function that has been called but not
prototyped.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.