[comp.unix.ultrix] <stdarg.h> vs <varargs.h> in Ultrix 4.0

chang@osc.COM (Lai-Chang Woo) (03/01/91)

My problem is that I need the ANSI-style definitions in <stdarg.h> for C++
functions, but Ultrix 4.0 cc only works with <varargs.h>.  Needless to say,
the two files are nothing like each other.  I thought of producing some sort
of hybrid, but some experimentation led to the discovery that when the
all-powerful va_alist is not included in the argument list of the called
routine, the variable arguments from the calling routine are not even pushed
onto the stack!  To illustrate:

-----
void func ( argA, argB /* , va_alist */ )
char *argA;
char *argB;
/* int va_alist; */
{
.
.
.
}

main ()
{
.
.
    func ( "hello", "world", "variable", "part" );
.
.
}
-----

when run under dbx, does not show up "variable" or "part", or any pointer to
them, anywhere on the stack.

But I can't include va_alist in the C++ function declaration, and my C++
translator (AT&T version 2.0, btw) doesn't insert it for me either.  Short
of fixing the translator, how can I get around this?  Has anyone successfully
produced a hybrid header file that works under the circumstances?

Currently I fix the C output of the translator by hand, but that is painful
to say the least, so any help would be most appreciated.  Please email replies
to chang%osc.osc.com@uunet.uu.net.  I'll post a summary if anyone requests it.

Thanks in advance.
Lai-Chang Woo
Versant Object Technology