rgr@cbnewsm.ATT.COM (robert.g.robillard) (08/12/89)
I was just looking at variargs.h for the first time and found a little inconsistency. In K&R 2, it says (page 254) that va_start() gets two arguments : va_start(va_list ap, lastarg); but on my Sun (running SunOS 4.0) it only wants the first argument. What's up? Is somebody out of date? Thanks in Advance -- | Duke Robillard | | Internet: rgr@m21ux.att.com | BITNET: rgr%m21ux.uucp@psuvax1 | | UUCP: {backbone!}att!m21ux!rgr | (maybe) |
gwyn@smoke.BRL.MIL (Doug Gwyn) (08/12/89)
In article <2658@cbnewsm.ATT.COM> rgr@cbnewsm.ATT.COM (Duke Robillard) writes: >I was just looking at variargs.h for the first time and >found a little inconsistency. In K&R 2, it says (page 254) >that va_start() gets two arguments : > va_start(va_list ap, lastarg); >but on my Sun (running SunOS 4.0) it only wants the first >argument. What's up? Is somebody out of date? Geez, where to begin. First, note that K&R 2nd Ed. explicitly describes Standard C, not the historical C found implemented on your Sun. Next, note that K&R 2 describes the macros defined by including <stdarg.h>, not <varargs.h> which was a precursor that served as a rough guide when X3J11 designed the specification for <stdarg.h>. The Standard C variadic argument mechanism is considerably different from the old varargs approach; many compiler vendors will be providing both headers for reasons of backward compatibility. Finally, note how to spell <varargs.h>.