Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!sdd.hp.com!think.com!paperboy!meissner From: meissner@osf.org (Michael Meissner) Newsgroups: comp.lang.c Subject: Re: Do you use stdarg, varargs or ya-args? Message-ID: Date: 10 May 91 16:47:15 GMT References: <2755@muffin.cme.nist.gov> Sender: news@OSF.ORG Organization: Open Software Foundation Lines: 37 In-reply-to: libes@cme.nist.gov's message of 10 May 91 04:24:41 GMT In article <2755@muffin.cme.nist.gov> libes@cme.nist.gov (Don Libes) writes: | The obvious question is: why bother using stdarg? Is any vendor | really going to omit varargs 5 or even 10 years from now? I seriously | doubt it. (I'm betting one of my coworkers money on this.) I suppose | that eventually one may have to explicitly use some flag when | compiling (say "-varargs"), but don't you think the support will | always be provided by the vendor somehow? (All the STDC compilers | already provide a shitload of extensions.) A couple of things: 1) There were two or three machines that could not support varargs in any fashion (I don't remember the particulars). 2) Then there was pyramid which had '{' in va_start, and '}' in va_end. 3) The MIPS based computers also have a subtle bug with varargs. In the MIPS calling sequence, if the first two arguments were floating point, they were passed in FP registers, rather than the GP registers. However, varargs only works on the GP register set, so that if you have a varargs function which takes a floating point value as the first argument, the wrong values are used. 4) On the 32x32 systems, arguments are typically passed on the stack. However, for building the kernel, the convention is that the first two arguments are passed in r0 and r1. This breaks varargs programs, so I recently modified GCC to always pass arguments to stdargs functions on the stack. -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142 Considering the flames and intolerance, shouldn't USENET be spelled ABUSENET?