[comp.lang.c++] stdarg.h on sun4

muller@sdcc7.ucsd.EDU (Keith Muller) (03/30/89)

Thought I might pass this on in case someone else runs into this...
(Of course if this topic has been covered before I apologize).

I just ran into a problem with C++ on a sparc (sun4) machine using the
ATT C++. It turns out that stdarg.h will not work on the sparc machine.
To get variable length args to work, the last arguement in a function
has to have the name __builtin_va_alist. Any other name (or the lack of
a name in stdarg.h's case) will not generate the proper code to pass the
variable number of args (due to the way sparc handles function parameters).

In my case I got around this by post-processing the c code emitted by C++
to use the varargs.h equivalent mechanisms (I didn't want to modify the
C++ source to work around this). Clearly this is not a clean solution,
but it got me out of a short term bind.

(Of course __builtin_va_alist is not that palatable either)....

	Keith Muller
	University of California, San Diego