Mail Archives: djgpp-workers/2000/06/05/15:34:28
Alain Magloire wrote:
> Maybe it's me who got this backward or I've missed a couple of threads.
> To recap what I've understood in this thread, ANSI C says that
> <stdarg.h> should not be part of <stdio.h> because it polluates
> the namespace etc ... (I do not have the rationale). Most OS/platforms
> go around this, for functions like vfprintf(..) by including their
> own header .i.e solaris <sys/va_list.h> or define va_list Watcomm etc ..
Not va_list but __va_list, __gnu_c_va_list, __builtin_va_list whatever.
> Some other just includes <stdarg.h> DJGPP, GNU/Linux/Glibc (?)
Wait, now I don't understand you. DJGPP's <stdio.h> does not include
<stdarg.h>, neither glibc does.
> And on those platforms if people takes things for granted
> code like this :
>
> #include <stdio.h>
> void warnings (char *s, ...)
> {
> char *t;
> va_list ap;
>
> va_start(ap, s);
> while (t = va_arg(ap, char *))
> {
> /* do stuff */
> }
> va_end(ap);
> }
>
> Will work compile under DJGPP, GNU/Linux, since <stdio.h> include <stdarg.h>
This piece of will compile but won't link because of missing va_start() & Co.
That's why I've said that updating headers won't cause any problems. But Eli
told that it's wrong - va_start() could be called in other source file.
Laurynas
- Raw text -