Why stdarg.h is part of GCC instead of libc?
Mike Frysinger
vapier@gentoo.org
Sat Jun 11 05:47:00 GMT 2016
On 09 Jun 2016 10:21, Václav Haisman wrote:
> On 9 June 2016 at 04:38, YuGiOhJCJ Mailing-List wrote:
> > I was checking from what package the headers I am using for a program are provided:
> > * ctype.h: It is part of libc [1]
> > * errno.h: It is part of libc
> > * getopt.h: It is part of libc
> > * limits.h: It is part of libc
> > * ...
> >
> > Then I was amazed to discover that:
> > * stdarg.h: It is part of gcc [2]
> >
> > I don't understand why.
> > Maybe it is an historical reason or something like that.
> > I don't see any reason to make the stdarg.h header part of GCC instead of libc.
> > AFAIK, all these headers are standards C headers.
> > In other words, they should not be specific to the compiler.
> >
> > Someone can explain me why stdarg.h is part of GCC instead of libc?
> > Is it documented somewhere that stdarg.h is not part of libc?
> > Are there other standard C headers like this one that are not part of libc?
>
> Contents of stdarg.h is historically very platform specific. It
> depends on ABI of given platform and it is tied to how the ABI
> specifies and the compiler implements variadic functions. E.g.,
> va_start() is implemented in terms of __builtin_va_start().
right -- in order to implement stdarg, you have to know exactly how args
are passed to functions (registers/stack/etc...), as well as how things
change depending on their type (like 64-bit/double being split between
two 32-bits or via diff reg types). there's really no way all of this
could be implemented in pure C which means the compiler has to do it.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/libc-help/attachments/20160611/6ea787d7/attachment.sig>
More information about the Libc-help
mailing list