Message-Id: <200006051915.PAA04340@qnx.com> Subject: Re: ANSI C and stdio.h To: djgpp-workers AT delorie DOT com Date: Mon, 5 Jun 2000 15:15:37 -0400 (EDT) From: "Alain Magloire" In-Reply-To: <200006051822.OAA29585@envy.delorie.com> from "DJ Delorie" at Jun 05, 2000 02:22:23 PM X-Mailer: ELM [version 2.5 PL0b1] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 Precedence: bulk > > > > Problems like this do not appear in simple "hello world" type of > > programs, but rather creep in when you are doing advanced or large or > > medium or big projects with interdepencies etc ... when you > > move the enviroment around, this is where you hit the brick wall. > > I can't think of a single program that includes stdio.h but not > stdarg.h (or vararg.h), and then tries to use "va_list" as something > other than the "usual" meaning. That's the kind of program our > current headers would cause problems with. If anyone *does* code like > that, they're asking for trouble even though the program is > technically 100% compliant. 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 should not be part of 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 or define va_list Watcomm etc .. Some other just includes DJGPP, GNU/Linux/Glibc (?) And on those platforms if people takes things for granted code like this : #include 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 include but fail to compile under for example Solaris. This is probably picknitting, because I doubt a portable application will call va_arg() without including but one may get use to just include ... > Compliant programs (except pedantic examples like mine above) work > just fine. My point is that some common broken programs should work > also. I'd rather be lenient to the clueless user if I can do that > without causing grief for other users. > > Thus, there are two cases: > > 1. Broken programs that work under DJGPP. > > 2. Valid programs that break under DJGPP. > > I'd like to maximize the first while minimizing the second. Yes, fine goals. I just hope to make (1) work, you don't deviate too much from the std or carry a lot of baggages. BTW, I'm talking in general and not targetting stdio.h/stdarg.h issue in particular, it just seems weird that to minimize FAQ one would prefer to deviate from the std. In my env. if I go this way Q/A would have my head on a platter the next day ;-) Later. -- au revoir, alain ---- Aussi haut que l'on soit assis, on n'est toujours assis que sur son cul !!!