Xref: utzoo comp.unix.ultrix:3819 comp.sys.dec:3468 Path: utzoo!attcan!uunet!mailrus!swan!hawk!pmaresch From: pmaresch@hawk.ulowell.edu (Pierre Mareschal) Newsgroups: comp.unix.ultrix,comp.sys.dec Subject: on the DECstation 3100 Keywords: varargs stdarg decstation Message-ID: <1026@swan.ulowell.edu> Date: 27 Jun 90 18:48:19 GMT Sender: news@swan.ulowell.edu Reply-To: pmaresch@hawk.ulowell.edu (Pierre Mareschal) Followup-To: comp.unix.ultrix Distribution: na Organization: University of Lowell, CS Dept Lines: 50 Hi, I encountered some problem on the DECstation 3100 with varargs. The simple program below doesn't work if I change all the occurence of double by float. Why? What is the difference between varargs and stdarg? Thanks for anwering. Pierre. ---- #include void f(va_alist) va_dcl { va_list ap; char *p, *sval, *fmt; int ival; double fval; va_start(ap); fmt = va_arg(ap, char*); for(p = fmt; *p; p++) { if(*p != '%') putchar(*p); else switch(*++p) { case 'f': fval = va_arg(ap, double); printf("%f",fval); break; case 'd': ival = va_arg(ap, int); printf("%d",ival); break; case 's': sval = va_arg(ap, char*); printf("%s",sval); break; } } va_end(); } main() { double w = 4.7; f("%s : %d %d %d %f\n", "test", 3, 2, 1, w); } ---- :- pmaresch@hawk.ulowell.edu