delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/06/05/13:09:37

Message-Id: <200006051708.UAA17738@alpha.netvision.net.il>
Date: Mon, 05 Jun 2000 20:07:21 +0200
X-Mailer: Emacs 20.6 (via feedmail 8.1.emacs20_6 I) and Blat ver 1.8.5b
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
To: lauras AT softhome DOT net
CC: djgpp-workers AT delorie DOT com
In-reply-to: <393BC449.B6CB56C@softhome.net> (message from Laurynas Biveinis
on Mon, 05 Jun 2000 18:16:25 +0300)
Subject: Re: ANSI C and stdio.h
References: <3937DEA9 DOT 63606B27 AT softhome DOT net>
<200006021918 DOT PAA03693 AT envy DOT delorie DOT com> <393BB779 DOT DDA55FEC AT cyberoptics DOT com> <393BB043 DOT 75C23C6D AT softhome DOT net> <200006051552 DOT SAA23340 AT mailgw1 DOT netvision DOT net DOT il> <393BC449 DOT B6CB56C AT softhome DOT net>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Mon, 05 Jun 2000 18:16:25 +0300
> From: Laurynas Biveinis <lauras AT softhome DOT net>
> 
> BTW, if user includes <stdio.h> only, from all stdarg machinery
> he gets *only* va_list. No va_start, va_arg, va_end...

That's because va_list is the only type you basolutely need to call
vfprintf and friends.  The other ones are only needed if you
manipulate va_arg explicitly in your code, in which case you must
include stdarg.h.

> I cannot imagine reasonable code which would need va_list and not
> those macros.

I've seen such code (and wrote it) many times.  For example, the
simplest use of vsprintf is like this:

    int print_to_device (const char *fmt, va_list ap)
    {
      char buf[200];
      int ret_val;

      ret_val = vsprintf (buf, fmt, ap);
      send_string_to_device (buf);
      return ret_val;
    }

This compiles and links without problems with only stdio.h included.

- Raw text -


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