Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think.com!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.lang.c Subject: Re: stdarg Message-ID: <1991Feb7.043715.1224@Think.COM> Date: 7 Feb 91 04:37:15 GMT References: <588@taumet.com> <1991Feb6.171144.7182@Neon.Stanford.EDU> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 24 In article enag@ifi.uio.no (Erik Naggum) writes: >In article <1991Feb6.171144.7182@Neon.Stanford.EDU>, Dave Eisen writes: >> Probably a reasonable decision. But it does make it a pain to deal >> with the third party software we use that is full of functions >> that can take 0 or more arguments. >How do these functions determine how many arguments to use, and what >type they are? Well, consider a function taking a variable number of strings, followed by a null pointer. The type is known by definition, and the number of arguments can be determined by looking at them. I'm not claiming that this is a good programming style, but an awful lot of people seem to be assuming that a fixed argument is needed in order to determine how to process the remaining arguments. While this style could easily be replaced with one where there is an initial fixed argument containing the count of variable arguments, that's more prone to error: during program maintenance it is likely that an argument will be added but the argument count could easily be left unchanged. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar