rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re: difference between <varargs.h> and <stdarg.h> ?
       [not found]   ` <1993Apr15.042726.22102@sserve.cc.adfa.oz.au>
@ 1993-04-15  4:33     ` Christopher JS Vance
  0 siblings, 0 replies; only message in thread
From: Christopher JS Vance @ 1993-04-15  4:33 UTC (permalink / raw)
  To: rc

In article <1993Apr14.163211.4342@thunder.mcrcim.mcgill.edu> in
newsgroup comp.lang.c talking about <stdarg.h> and <varargs.h>
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
| <varargs.h>, and you can write a function using <stdarg.h> 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 <stdarg.h>.  (Pyramid
have shipped <varargs.h> 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 <varargs.h> 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 <stdarg.h> properly, and my way meant minimal
change to the bodies of these routines.

I also toyed with trying to make a <stdarg.h> that did the right
thing, but I knew that <varargs.h> 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1993-04-15  4:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1993Apr09.023608.22375@rat.csc.calpoly.edu>
     [not found] ` <1993Apr14.163211.4342@thunder.mcrcim.mcgill.edu>
     [not found]   ` <1993Apr15.042726.22102@sserve.cc.adfa.oz.au>
1993-04-15  4:33     ` difference between <varargs.h> and <stdarg.h> ? Christopher JS Vance

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).