On Sun, 2003-02-16 at 01:37, Ryan Pavlik wrote:

> IIRC, in K&R C (and ANSI too), () makes a default int parameter.  This
> also happens to be the result of no prototype

Actually, no.  K&R C will just pass whatever data you give it to the
function without regard of the type of the arguments.  Indeed, there was
no way to declare the argument types of an external functions in K&R C. 
That's why you can't pass float arguments to functions.  Even if you
declared an argument to take a float rather than a double, C would
silently promote all float arguments to doubles at both the calling site
and the function definition.

In ANSI C, a function without a prototype is automatically given a
"Miranda"[0] prototype that matches the arguments of its first use. 
Usages after the first use will use the miranda prototype.

That's one of the changes that C++ introduced to the C language for more
type safety ... required prototypes for all functions.

-- 
-- Jim Weirich     jweirich / one.net    http://w3.one.net/~jweirich
---------------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct, 
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

[0] Miranda Prototypes.   So named for the US miranda rights read to
criminals upon arrest ... paraphrased in part "... if you do not have an
attorney, one will be appointed to you ...".   Substitute "prototype"
for "attorney".