From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ccadfa.cc.adfa.oz.au ([131.236.1.2]) by hawkwind.utcs.toronto.edu with SMTP id <2764>; Thu, 15 Apr 1993 00:34:13 -0400 Received: by ccadfa.cc.adfa.oz.au (5.65c/1.34) id AA11980; Thu, 15 Apr 1993 14:33:53 +1000 Message-Id: <199304150433.AA11980@ccadfa.cc.adfa.oz.au> To: rc@hawkwind.utcs.toronto.edu Subject: Re: difference between and ? From: Christopher.Vance@adfa.oz.au (Christopher JS Vance) Organization: Computer Science, University College, UNSW/ADFA, Canberra, Australia References: <1993Apr09.023608.22375@rat.csc.calpoly.edu> <1993Apr14.163211.4342@thunder.mcrcim.mcgill.edu> <1993Apr15.042726.22102@sserve.cc.adfa.oz.au> Date: Thu, 15 Apr 1993 00:33:53 -0400 Sender: cjsv@ccadfa.cc.adfa.oz.au In article <1993Apr14.163211.4342@thunder.mcrcim.mcgill.edu> in newsgroup comp.lang.c talking about and mouse@thunder.mcrcim.mcgill.edu (der Mouse) writes: | On systems where both exist, they are normally compatible, in that you | can use an ANSI prototype to call a function written to use | , and you can write a function using and then | call it as a varargs function from traditional code. No guarantees, of | course, but when both headers exist this will usually work. I found, when porting Byron Rakitzis' implementation of rc to a Pyramid 9810 running OSx 5.1, that I had a purported ANSI-compatible compiler (grokking prototypes and const), but no . (Pyramid have shipped for years, and it's a bit strange...) This rc uses prototyped functions throughout, using new-style for both declarations and definitions. What worked for me was to remove the argument prototypes (just from the variadic functions) leaving the return type and empty parentheses. For the definition, the Pyramid allows it to include the va_alist *after* some fixed arguments (if there were fixed arguments, they had to be declared old-style with only the argument names inside the parentheses). And I had to change the invocations of va_start in the routine bodies to omit the second parameter. I guess I could have hacked the definitions even more to put the va_alist in as the only argument, but this was the only architecture I had which didn't do properly, and my way meant minimal change to the bodies of these routines. I also toyed with trying to make a that did the right thing, but I knew that worked, so it was easier to do this workaround. (And when I looked at gcc's way I felt sick. I still haven't the time or heart to try to get gcc doing things the right way on the Pyramid.) -- Christopher