Re: [PATCH] Re: [ipchains] logging tcp/udp port numbers

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Fri, 20 Nov 1998 14:14:41 +0000


Linus Torvals wrote:
> va_args() is a compiler specific thing anyway, and as such it would not be
> problematic to just make it do the right thing.
>
> I've changed the Linux kernel to do what the standard obviously says has
> to be done, but I'm just grumbling about a _stupid_ standard. va_args()
> should _know_ that short is promoted and do the right thing.

I agree it's a yucky part of the standard, but there probably wasn't
much choice at the time. It would seem ok change it now though.

On really old compilers va_arg is implemented as _ordinary_ C code.
Even though the code is compiler specific, there is no way for it to do
what you'd like. It can't conditionalise on sizeof() because
sizeof(int) == 4 == sizeof(float) (sometimes). It can't do stringifying
things on the type name because of typedefs. sizeof(type + 0) gets
pretty close to supplying the pointer tweaking details, but doesn't work
on void * (the only exception I can think of).

I think GCC actually does do what you want, except for some machine
descriptions there's a bug. I think I saw an EGCS thread about it.

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/