Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: comp.lang.c Subject: Re: Problem with either ANSI 'C' or Dr Dobbs Journal. Message-ID: <8415@utzoo.UUCP> Date: Sat, 15-Aug-87 18:17:12 EDT Article-I.D.: utzoo.8415 Posted: Sat Aug 15 18:17:12 1987 Date-Received: Sat, 15-Aug-87 18:17:12 EDT References: <449@sugar.UUCP> <8383@utzoo.UUCP>, <894@haddock.ISC.COM> Organization: U of Toronto Zoology Lines: 24 > "A.6.2 Undefined behavior: ... A function that accepts a variable number of > arguments is called, but no prototype declarator with the ellipsis notation > is in scope." [Oct86 dpANS] > > In other words, a variadic function must have a prototype. This implies that > a function called without a prototype in scope may be assumed to have a fixed > number of arguments. Correct -- I think -- but only after considerable study. A.6.2 is in the appendix, thus is *not* part of the standard. Careful study of 3.3.2.2 *suggests* the truth of the A.6.2 note, but I wouldn't want to have to try to prove it rigorously from the current wording. 3.3.2.2 observes: "If no function prototype declarator is in scope... [and] the number of arguments does not agree with the number of formal parameters, the behavior is undefined." So far so good... but what *is* the "number of formal parameters" for a variadic function?? 3.5.3.3, Function Declarators, gives vague and inconsistent hints but no definitive guidance. Unless I have missed some clear statement somewhere else, I think wording changes are in order -- the A.6.2 statement is not unambiguously supported by the standard proper. The simplest fix would be to add the A.6.2 statement quoted above somewhere around line 8 of 3.3.2.2 (draft of 1 Oct 1986). [Doug, you listening?] -- Support sustained spaceflight: fight | Henry Spencer @ U of Toronto Zoology the soi-disant "Planetary Society"! | {allegra,ihnp4,decvax,utai}!utzoo!henry