473,387 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Why va_start takes 2 arguments



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.

Nov 14 '05 #1
1 1316
"Minti" <mi************@yahoo.com> writes:

[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.
--
Ben Pfaff
email: bl*@cs.stanford.edu
web: http://benpfaff.org
Nov 14 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: frankg | last post by:
When I compile this file ------------------------------------------------------ #include <stdarg.h> template <class Any> void var_arg_func(int dimension_count, ...) { int dimensions;...
3
by: Douwe | last post by:
I try to build my own version of printf which just passes all arguments to the original printf. As long as I keep it with the single argument version everything is fine. But their is also a version...
11
by: Neo | last post by:
Why the following code is compilable? The function abc() doesn't take any arguments, still i can call the function with arbitraty number of arguments. Even compiler doesn't show any warning. What...
17
by: gyan | last post by:
Why it is that following program behaving like this: 1 #include <stdlib.h> 2 #include <stdarg.h> 3 #include <stdio.h> 4 5 void comd(char *p,int a, ...); 6 void f(void); 7 8 main(){
4
by: Sekhar | last post by:
While using variable arguments we have to initialize variable argument like va_start( arg_ptr, prevParam ); Can any body explain what is the significance of second parameter(prevParam) while...
5
by: Ross | last post by:
Hi, I have the following program: #include <stdarg.h> class A { public: A() { } }
3
by: mahesha | last post by:
What should be the behaviour of following program?. Is this behaviour is undefined or compiler should report error for this case?. Can anybody point me to pages in the standard where it is...
8
by: Manju | last post by:
Hi All, I am facing a strange issue. if the string passed to va_start()/vsnprintf() contains "%n", there is a segmentation fault. If it's replaced with any other character, no issues. Any idea...
4
by: mainargv | last post by:
hi How do you rewrite codes with " ... va_list va_start va_etc", so that simple c compiler don't have to deal with them. I have written a simple c->verilog compiler but it can't deal with...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.