This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why stdarg.h is part of GCC instead of libc?


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

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]