Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: meissner@osf.org (Michael Meissner)
Subject: Re: C compiler
Date: 22 Jan 92 14:02:12	[thread overview]
Message-ID: <MEISSNER.92Jan22140213@curley.osf.org> (raw)
In-Reply-To: herbert@wam.umd.edu's message of Wed, 22 Jan 1992 07:41:22 GMT

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.


  reply	other threads:[~1992-01-22 19:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-01-22  7:41 C compiler David Mark Herbert
1992-01-22 19:02 ` Michael Meissner [this message]
  -- strict thread matches above, loose matches on Subject: below --
1994-08-19 18:33 c compiler mike emmel
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox