Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!+ From: David.Steere@CS.CMU.EDU Newsgroups: comp.sys.mips Subject: Question on cc Message-ID: Date: 18 Jul 90 14:53:17 GMT Organization: Carnegie Mellon, Pittsburgh, PA Lines: 34 BACKGROUND: I'm porting a file system to the Dec 3100. Our code is mostly written in C++, which gets precompiled (as it were) into standard C. The pmax C compiler is standard C (pcc), so for the most part, this isn't a problem. However, we are having a problem with procedures with a variable number of arguments (like printf). Typically, when such a procedure is called, the parameters are read off the stack, using a pointer to the first argument to reference the other arguments. This assumes that the arguments are written to the stack. Syntactically, variable length procedure headers can be declared by including , and having the last argument be va_alist. varargs.h declares various macros which basically handle the referencing to the stack. In the Pmax compiler, the first several arguments are not written onto the stack automatically. So they are not found when the procedure is called. It turns out that the compiler looks for the symbol "va_alist" in the procedure header, and if it is found forces all the arguments to be written to the stack. Okay, this seems like a hack and it seems to work fine, except that we use C++, which during preprocessing renames all the variables, prepending things like au0_ on the front of variable names. So va_alist is now au0_va_alist. Since that isn't the same as va_alist, the compiler does not force all the arguments to the stack. QUESTION: Is there a way to tell the compiler to force arguments to the stack for a particular routine? thanks, david.