http://www.cplusplus.com/reference/cstdarg/va_list/ According to the above link, va_list is an argument or parameter used in some macros - va_start, va_arg, va_end. These macros are present in the stdarg.h file.

I know that va_list can hold multiple values but what kind of an entity is va_list? My question is what is the underlying mechanism behind va_list? How is it able to hold multiple values? (For example, an array can hold multiple values and the mechanism behind it is multiple memory locations referenced by subscript values. Array is a predefined data structure present in C.)

My second question is where is va_list defined?

  • cplusplus.com/reference/cstdarg/va_list Commented Mar 18, 2014 at 19:25
  • 2
    Unclear what help you need. Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it’s hard to tell what problem you are trying to solve or what aspect of your approach needs to be corrected or explained. See the How to Ask page for help clarifying this question.
    – gnat
    Commented Mar 18, 2014 at 19:26
  • @RobertHarvey I know that it is used as a parameter for the macros in <cstdarg> but what exactly is this entity. And where is it defined?
    – aste123
    Commented Mar 18, 2014 at 19:29
  • @gnat I will edit the question.
    – aste123
    Commented Mar 18, 2014 at 19:30
  • 2
    It's defined in stdarg.h There are many places on the Internet where you can view the source; here's one: opensource.apple.com/source/xnu/xnu-792.13.8/EXTERNAL_HEADERS/… Commented Mar 18, 2014 at 19:42

3 Answers 3


The answer to your question is here: https://stackoverflow.com/questions/4958384/what-is-the-format-of-the-x86-64-va-list-structure

The va_list type is an array containing a single element of one structure containing the necessary information to implement the va_arg macro. The C definition of va_list type is given in figure below

typedef struct {
   unsigned int gp_offset;
   unsigned int fp_offset;
   void *overflow_arg_area;
   void *reg_save_area;
} va_list[1];

va_list is defined in stdarg.h as http://www.cplusplus.com/reference/cstdarg/va_list/ states.

You can refer to the book "The Standard C Library" by Plauger if you need to know the ins and outs of the std libc.


See also the ABI specification and the calling conventions for your target platform. For x86-64/Linux, read the x86-64 ABI supplement (see also the x86 calling conventions wikipage).

Several aspects of <stdarg.h> are built in the GCC compiler (e.g. thru __builtin_va_start, __builtin_va_arg, etc...) and <stdarg.h> is provided by the compiler. See also its __builtin_va_arg_pack, etc...

You might also be interested by libffi (e.g. if you want to dynamically build a call to a variadic function).


va_list generally does not store the values, it merely refers to them.

In the old days (and I believe still today on x86-32), parameters were passed on the stack. va_list was a simple pointer, pointer arithmetic would be used to move va_list through the arguments on the stack.

Many architectures nowadays pass parameters in registers. In some cases it may be possible to simply push the registers onto the stack and then iterate through them as before, but in more complex cases where different types of parameter can be placed in different types of register this is not possible. So va_list is often a more complex structured type to keep track of the different types of parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.