delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/06/05/15:34:28

Message-ID: <393BF350.4CF96661@softhome.net>
Date: Mon, 05 Jun 2000 21:37:04 +0300
From: Laurynas Biveinis <lauras AT softhome DOT net>
X-Mailer: Mozilla 4.72 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: ANSI C and stdio.h
References: <200006051915 DOT PAA04340 AT qnx DOT com>
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019