_z33 wrote:
> I'm clear... but, now wondering why for two days a guy from an R&D
> dept of an MNC is arguing with me, saying that a function with empty
> argument specification implies having implicit "int" type arguments.
> (similar to the implicit assumption of return type of functions to "int"
> when none is specified explicitly).
If you call a function for which a prototype is in scope, the
arguments will be coerced to the specified types. E.g. if you have:
void foo(float x) { ... }
...
foo(1.0);
k will be passed as a float (even though the literal has type double).
OTOH, if the function was declared without its argument list, the
arguments will be converted using the K&R default conversions, i.e.
char and short are converted to int, float is converted to double, and
other types are passed without conversions.
Similarly, if a function has a variadic protoype (e.g. the printf()
family), the variadic arguments (those accounted for by the ellipsis)
are subject to the default conversions.
--
Glynn Clements <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming"
in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html