Date: Tue, 20 Jan 1998 18:23:34 PST From: Bill Fenner <fenner@parc.xerox.com> To: fenner@parc.xerox.com, joelh@gnu.org Cc: current@freebsd.org, sef@kithrup.com Subject: Re: Nasty GCC bug? Message-ID: <98Jan20.182345pst.177476@crevenia.parc.xerox.com>
next in thread | raw e-mail | index | archive | help
It's easy to read it to say that promotions are required. However, all
it really says is that ANSI only guarantees that things work if you
match types with the promoted type. However, if you have some way to
intuit what type was passed in (e.g. Terry's description of an argument
passing scheme which passes types along with values and delays
promotion until required), you might see a loop like:
switch (va_type(ap)) { /* non-ANSI function */
case VA_CHAR:
c = va_arg(ap, char); /* ANSI says this is undefined */
break;
...
}
Now, that usage of va_arg(), according to ANSI, is undefined. That
just means that ANSI doesn't tell us what it's supposed to do, not that
ANSI requires that it doesn't do something useful.
I was just trying to refute sef's assertion that a compiler/library
that implemented printf() in this way was buggy or wrong. It's not.
It's defining a certain behavior that ANSI chose not to define. Terry
is asserting that FreeBSD should have this behavior, which is a fine
thing to have an argument about, but it shouldn't be based upon an
assertion that it's an incorrect thing to do.
Bill
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?98Jan20.182345pst.177476>
