'Gcc compiler builtins constants

Do anyone know wht this code in stdarg.h do

What are these __builtin_va_list

And what do __builtin_va_start(x,y) returns



Solution 1:[1]

These are GCC's builtins for implementing the stdarg.h variadic function features. The macros in stdarg.h expand to their __builtin equivalents, and the __builtin versions trigger the compiler to emit the appropriate code.

This allows the stdarg.h macros to behave in ways that couldn't easily be done in pure C or even inline assembly.

This is preferable to just having the compiler recognize the special identifiers va_list, va_start, etc, because it still allows the possibility for someone to rewrite those headers and implement them in their own way. Or for extremely old code that predates the standard stdarg.h and might use the va_* identifiers for something else.

As a programmer, you normally shouldn't use them directly; use the standard stdarg.h types and macros instead: va_list, va_start, etc.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nate Eldredge