Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1exp 10/6/83; site ihnss.UUCP Path: utzoo!linus!decvax!harpo!eagle!hou5h!hou5g!hou5f!ariel!houti!hogpc!drux3!ihnp4!ihnss!warren From: warren@ihnss.UUCP Newsgroups: net.lang.c Subject: Re: var args Message-ID: <1767@ihnss.UUCP> Date: Wed, 26-Oct-83 10:59:46 EDT Article-I.D.: ihnss.1767 Posted: Wed Oct 26 10:59:46 1983 Date-Received: Fri, 28-Oct-83 03:58:46 EDT References: utzoo.3272 <240@turtleva.UUCP> Organization: AT&T Bell Labs, Naperville, Il Lines: 24 The technique of declaring a function with the maximum number of expected arguments and then passing them on: foo(a1,a2,a3,a4,...an) char *a1,*a2, ..., *an; { error(errno,fmt,a1, ..., an); DOES NOT work in all implementations. An obvious failure occurs when the stack isn't big enough to accomodate all of the arguments that aren't passed to foo. A less obvious problem that I have seen (I forget exactly which machine it was on) is that the compiler passes the pointer arguments using "effective address" type instructions to get the pointer, rather than just copying the bits, and the machine generates some sort of fault if the address in the pointer is invalid. Since the junk you pick up on the stack can to be an invalid address, your code randomly fails depending on what happens to be on the stack. -- Warren Montgomery ihnss!warren IH x2494