Do you use stdarg, varargs or ya-args?

Michael Meissner meissner at osf.org
Sat May 11 02:47:15 AEST 1991


In article <2755 at muffin.cme.nist.gov> libes at cme.nist.gov (Don Libes)
writes:

| The obvious question is: why bother using stdarg?  Is any vendor
| really going to omit varargs 5 or even 10 years from now?  I seriously
| doubt it.  (I'm betting one of my coworkers money on this.)  I suppose
| that eventually one may have to explicitly use some flag when
| compiling (say "-varargs"), but don't you think the support will
| always be provided by the vendor somehow?  (All the STDC compilers
| already provide a shitload of extensions.)

A couple of things:

   1)	There were two or three machines that could not support
	varargs in any fashion (I don't remember the particulars).

   2)	Then there was pyramid which had '{' in va_start, and '}' in
	va_end.

   3)	The MIPS based computers also have a subtle bug with varargs.
	In the MIPS calling sequence, if the first two arguments were
	floating point, they were passed in FP registers, rather than
	the GP registers.  However, varargs only works on the GP
	register set, so that if you have a varargs function which
	takes a floating point value as the first argument, the
	wrong values are used.

   4)	On the 32x32 systems, arguments are typically passed on the
	stack.  However, for building the kernel, the convention is
	that the first two arguments are passed in r0 and r1.  This
	breaks varargs programs, so I recently modified GCC to always
	pass arguments to stdargs functions on the stack.
--
Michael Meissner	email: meissner at osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142

Considering the flames and intolerance, shouldn't USENET be spelled ABUSENET?



More information about the Comp.lang.c mailing list