Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!mp.cs.niu.edu!ux1.cso.uiuc.edu!cs433aw From: cs433aw@ux1.cso.uiuc.edu (Chris Houck) Newsgroups: comp.unix.ultrix Subject: Problems using Message-ID: <1991May8.203720.6846@ux1.cso.uiuc.edu> Date: 8 May 91 20:37:20 GMT Organization: University of Illinois at Urbana Lines: 60 Hi, I'm getting some really weird behavior with using the package under Ultrix 4.1. I'm trying to run the following program --- when the size of structure xxx is 12 or less I get the normal behavior, but when I increase xxx to size 16 (by uncommenting the "int d;" line) I don't get the correct values for the data I try to read with va_arg(). Any ideas? Should I be using a different variable argument package? (This is with both MIPS cc 2.0 and gcc 1.37.1 --- It works on one of the local Multimaxes, but I'd rather not work there...) /* --------------------------------------------------------------- */ #include #include typedef struct XXX { int a,b,c; /* int d; */ } xxx; test(first, va_alist) xxx first; va_dcl { va_list ap; xxx data; va_start(ap); data = va_arg(ap, xxx); va_end(ap); printf("%d %d\n", first.a, first.b); printf("%d %d\n", data.a, data.b); printf("sizeof = %d\n", sizeof(xxx)); } main() { xxx a, b; a.a = 1; a.b = 16; b.a = 5; b.b = 15; test(a, b); } /* ------------------------------------------------------------ */ output when sizeof(xxx) == 12 : 1 16 5 15 sizeof = 12 output when sizeof(xxx) == 16 : 1 16 0 0 sizeof = 16 Thanks in adavance, -Chris Houck houck@biobio.cs.uiuc.edu