Why va_start takes 2 arguments

M

Minti

I was just checking


http://docs.freebsd.org/info/gcc/gcc.info.Varargs.html

and

http://www-ccs.ucsd.edu/c/stdarg.html

I seemed to have never given this simple thing much thought, but I was just
curious of the reason why this might be the case so I checked up the
Rationale at

http://www.lysator.liu.se/c/rat/d8.html

And it seems to have confused me more than before. Can anyone provide any
insight into what sort of implementations might find the second argument
intresting? And what is this thing about registers and function pointers.

Thanks.
 
B

Ben Pfaff

[about va_start]
Can anyone provide any insight into what sort of
implementations might find the second argument intresting? And
what is this thing about registers and function pointers.

In many implementations, va_start(list, arg) basically does
something similar to list = &arg + 1. Without the second
argument, the implementation would need an extension that
provided the last argument, e.g. a magic identifier like
__last_arg.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,059
Members
48,769
Latest member
Clifft

Latest Threads

Top