Subject: Re: stdarg.h?
To: None <madhvesh.s@ap.sony.com>
From: Klaus Klein <kleink@reziprozitaet.de>
List: netbsd-help
Date: 02/28/2004 20:40:49
On Saturday 28 February 2004 13:42, Madhvesh R S wrote:
> I am referring NetBSD-v1.6
> In files like vfprintf.c, vfscanf.c and vprintf.c
> of the source directory lib/libc/stdio, i noticed that
> the macro _BSD_VA_LIST_ is used instead of the type va_list.
>
> I noticed that stdarg.h defines the type va_list, it doesnot
> define a type _BSD_VA_LIST_.
>
> Is there a reason to use _BSD_VA_LIST_?
The reason for using _BSD_VA_LIST_ (from <machine/ansi.h>) instead
of va_list in <stdio.h> is: The application might be using either
<stdarg.h> or <varargs.h>, and the header has no idea to know.
Including either header itself would unnecessarily restrict the
implementation's choice.
So rather than including either one the header it will use the
generic, common definition used for va_list and lets the application
do as it pleases.
Using _BSD_VA_LIST_ in the definitions of those stdio functions isn't
strictly necessary since they are using <stdarg.h> internally, though.
It very likely is for consistency's sake.
- Klaus