🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3513

Re: Variable length arg lists in C (gcc): stdarg vs. varargs

#3513
From: Kenny McCormack
Date: Wed, 11 Oct 2000 00:00
30 lines
2178 bytes
In article <8s2a3q$ur8$1@flotsam.uits.indiana.edu>,
Kenneth Chiu <chiuk@cs.indiana.edu> wrote:
>In article <8s26b3$9vl$1@yin.interaccess.com>,
>Kenny McCormack <gazelle@interaccess.com> wrote:
>>	4) Question: From what I can tell, stdarg has the following
>>	   limitations:
>>...
>>		b) You have to have at least one fixed arg.  This causes it
>>		   to fail the "acid test" - namely, "Can I write a wrapper
>>		   around printf?"  This is mentioned in the man page
>>		   ("man stdarg" on a Linux system).
>>
>
>If your goal is to write a wrapper for printf, you can use stdarg to
>write a wrapper around the vprintf() series.  This may or may not be
>good enough for you.

The goal is not to solve any particular problem (other than the "find the
maximum of a list of numbers" problem shown above), but rather to understand
how the various implementations (of the variable args functionality) work.

What I'd like to see is an implementation of the max() function that doesn't
require a 0 to be passed to signal the end of the list (and, consequently,
has the limitation that 0 can't be a valid data point).

But thanks for the note about vprintf - this seems to imply that there
should be wrapper functions provided by the system for any "standard"
functions that take variable numbers of args.  I note that there is a
vscanf; are there any other standard functions that take variable numbers of
args?  (I can't think of any off hand, but I haven't tried very hard...)
Technical Details
Message-ID: <8s2apd$aqe$1@yin.interaccess.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8s26b3$9vl$1@yin.interaccess.com> <8s2a3q$ur8$1@flotsam.uits.indiana.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc89c,22450a31b48667a4
X-Google-Attributes: gidfc89c,public
X-Google-Thread: f65d0,22450a31b48667a4
X-Google-Attributes: gidf65d0,public
From: gazelle@yin.interaccess.com (Kenny McCormack)
Subject: Re: Variable length arg lists in C (gcc): stdarg vs. varargs
Date: 2000/10/11
Message-ID: <8s2apd$aqe$1@yin.interaccess.com>
X-Deja-AN: 680245128
References: <8s26b3$9vl$1@yin.interaccess.com> <8s2a3q$ur8$1@flotsam.uits.indiana.edu>
Organization: The official candy of the new Millennium
Reply-To: gazelle@interaccess.com
Newsgroups: comp.unix.programmer,gnu.gcc
X-Complaints-To: newsabuse@supernews.com