va_list used in <stdio.h>

Walter Murray walter at hpclwjm.HP.COM
Wed Aug 16 02:58:09 AEST 1989


Walter Bright writes:

> Since <stdio.h> is supplied by the *vendor*,
> the problem can be solved in one of two ways,

> 1. In stdio.h, include the lines:
> 	#ifndef __STDARG_H		/* #define'd by stdarg.h	*/
> 	#include <stdarg.h>		/* get definition of va_list	*/
> 	#endif

The problem with this is that it causes trouble for a program like
the following, which I think is perfectly legal.

   #include <stdio.h>
   #define va_start "My own personal macro"
   static char *va_list = va_start;
   main(){printf ("%s\n", va_list);}

Note that names like va_start and va_list are not reserved for
the implementation if the program has not explicitly included
any associated header.

Walter Murray
-------------



More information about the Comp.lang.c mailing list