Mail Archives: djgpp-workers/2000/06/05/15:16:33
>
>
> > 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
<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 ..
Some other just includes <stdarg.h> DJGPP, GNU/Linux/Glibc (?)
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>
but fail to compile under for example Solaris.
This is probably picknitting, because I doubt a portable application will call
va_arg() without including <stdarg.h> but one may get use to just include
<stdio.h>
...
> 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 !!!
- Raw text -