Path: utzoo!utgpu!attcan!uunet!husc6!spdcc!ima!haddock!karl
From: karl@haddock.ima.isc.com (Karl Heuer)
Newsgroups: comp.lang.c
Subject: Re: Syntax of function prototypes...
Message-ID: <6281@haddock.ima.isc.com>
Date: 19 Aug 88 21:16:33 GMT
References: <8808171403.AA05181@ucbvax.Berkeley.EDU> <6105@venera.isi.edu> <871@buengc.BU.EDU> <4165@adobe.COM>
Reply-To: karl@haddock.isc.com (Karl Heuer)
Organization: Interactive Systems, Boston
Lines: 14

In article <4165@adobe.COM> burgett@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@haddock.isc.com), The Walking Lint