From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,4671387d64020ad3 X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1992-01-22 11:45:46 PST Newsgroups: comp.sys.dec Path: sparky!uunet!think.com!paperboy.osf.org!meissner From: meissner@osf.org (Michael Meissner) Subject: Re: C compiler In-Reply-To: herbert@wam.umd.edu's message of Wed, 22 Jan 1992 07:41:22 GMT Message-ID: Sender: news@osf.org (USENET News System) Organization: Open Software Foundation References: <1992Jan22.074122.1541@wam.umd.edu> Date: 22 Jan 92 14:02:12 In article <1992Jan22.074122.1541@wam.umd.edu> herbert@wam.umd.edu (David Mark Herbert) writes: | long test1(y, cnt, va_alist) | double y; | long cnt; | va_dcl | { ... | } | | | main () | { | | printf ("Hello world\n"); | printf ("The answer is %ld\n", test1((double)2.3, 3L, 2L, 3L, 4L)); | } ^^^ ^^ | | So you can see an example of the problem I have, I have recreated this test | code from memory. I marked the arguments that do not seem to be passed | correctly. Has anyone else had this problem, and if so how can you fix it? When you use varargs, you are supposed to not have ANY other arguments on the list (ie, you get all arguments with va_arg). Also, the MIPS calling conventions cannot handle any varargs function whose first argument is passed in a floating point register. A work around is to pass a non floating point value as the first parameter. A better solution is to use the ANSI syntax and switch to stdarg.h, but this requires using c89 instead of cc. With stdarg.h, you can have a floating point value as the first argument, and initial arguments like you have. -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142 You are in a twisty little passage of standards, all conflicting.