Syntax of function prototypes...

Karl Heuer karl at haddock.ima.isc.com
Sat Aug 20 07:16:33 AEST 1988


In article <4165 at adobe.COM> burgett at steel.COM (Michael Burgett) writes:
>[int something();] indicates that "something" is a function returning an int,
>but nothing else.  If this is used with ANSI I believe the compiler will look
>at the first time you use a function to determine the arguments...

No, the correct behavior in the absence of a prototype is to simply apply the
default argument promotion rules and call the function.  The behavior is
undefined if the actual (promoted) arguments are not compatible with the
formal parameters, though, so if you have "something(1)" and "something(2.0)"
then at least one of them would evoke undefined behavior if called.  This may
be grounds for a warning, but it doesn't allow the compiler to construct and
enforce a prototype.

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list