* C compiler
@ 1992-01-22 7:41 David Mark Herbert
1992-01-22 19:02 ` Michael Meissner
0 siblings, 1 reply; 3+ messages in thread
From: David Mark Herbert @ 1992-01-22 7:41 UTC (permalink / raw)
I have a problem using the varargs on the Decstation 5000. It seems to zero
out the last and sometimes the first arguments.
#include "stdio.h"
#include "varargs.h"
long test1(y, cnt, va_alist)
double y;
long cnt;
va_dcl
{
long temp, sum=0.0;
va_list arg_marker;
printf ("y=%lf %ld\n", y, cnt);
va_start(arg_marker);
while (cnt--) {
temp = va_arg(arg_marker, long);
printf ("temp %ld\n", temp);
sum += temp;
}
return (sum);
}
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?
Dave.
--
___________________________________________________
David M. Herbert, University of Merryland
herbert@wam.umd.edu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: C compiler
1992-01-22 7:41 C compiler David Mark Herbert
@ 1992-01-22 19:02 ` Michael Meissner
0 siblings, 0 replies; 3+ messages in thread
From: Michael Meissner @ 1992-01-22 19:02 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* c compiler
@ 1994-08-19 18:33 mike emmel
0 siblings, 0 replies; 3+ messages in thread
From: mike emmel @ 1994-08-19 18:33 UTC (permalink / raw)
Hello I'm a unix user but I have a account on a dec alpha running vms.
I've read the online documentation about the C compiler and can't seem to
get my code to compile anybody interested in mailing a short letter with
examples of the compile switches in vms. the main library I use is cc -lm
(unix math lib) what's the equivalent in VMS and were can I find the
libraries and header files? I don't really wan't to spend several weeks
learning vms just compile a few programs and run them.
P.S. Is there a make facility on vms or should I just use the gnu make
port?
Please email me with any responses at mike@hobbs.chem.usu.edu.
Thanks Mike
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1994-08-19 18:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1992-01-22 7:41 C compiler David Mark Herbert
1992-01-22 19:02 ` Michael Meissner
-- strict thread matches above, loose matches on Subject: below --
1994-08-19 18:33 c compiler mike emmel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox