Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ncis.llnl.gov!helios.ee.lbl.gov!pasteur!ucbvax!agate!bionet!csd4.milw.wisc.edu!mailrus!tut.cis.ohio-state.edu!rutgers!cmcl2!phri!marob!daveh From: daveh@marob.MASA.COM (Dave Hammond) Newsgroups: comp.lang.c Subject: Passing variable #of args Message-ID: <470@marob.MASA.COM> Date: 20 Jan 89 13:38:07 GMT Reply-To: daveh@marob.masa.com (Dave Hammond) Organization: ESCC New York City Lines: 27 Two [semi-related] questions, first: Given B() which expects 3 arguments passed to it, it's reasonably obvious what can occur when A() invokes B() and passes less than 3 args. What potential problems exist if A() passes *more* than 3 args to B()? It seems to me that this would harm nothing, since the extra stuff ends up beyond the current stack position. Second: I was surprised to see the following in a "GNU-something" source file: lprintf(fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,10) char *fmt; { char buf[BUFSIZ]; sprintf(buf,fmt,a1,a2,a3,a4,a5,a6,a7,a8,a9,10) ... } Given the availability of varargs, is this style still acceptable and, more importantly, is it portable? -- Dave Hammond ...!uunet!masa.com!{marob,dsix2}!daveh