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

Linus Torvalds (torvalds@transmeta.com)
Wed, 18 Nov 1998 09:32:50 -0800 (PST)


On Wed, 18 Nov 1998, R Shapiro wrote:
> Linus Torvalds writes:
> > it (ie instead of using
> >
> > num = va_arg(args, short);
> >
> > it might be proper to use
> >
> > num = (short) va_args(args, int);
>
>
> I can't answer your other questions re: linuxppc gcc and varargs, but
> I can verify that the second form works properly in linuxppc 2.1.127
> (compiled with egcs 1.0-2e) while the first doesn't, at least in the
> context of the %h directive and ip_fw.c

Yes, I'm almost positive that the second version is always correct due to
the C language rules about integer promotions.

However, I also suspect that the first version really _should_ work, and
that it really is a problem in gcc or the varargs header files that makes
it not work.

Alternatively, I'd really like to know whether maybe the C standard really
says that you _have_ to use the second form. It's possible it does.

Basically, my worry is not so much about getting it to work, I just want
to know that it is _guaranteed_ to work and that we won't have to look
into this again a few years from now.

Linus

-
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/