Re: var args in kernel?

From: Jakub Jelinek
Date: Mon Nov 22 2004 - 18:35:13 EST


On Mon, Nov 22, 2004 at 04:42:43PM -0500, Bill Davidsen wrote:
> Assignment of struct to struct has been a
> part of C since earliest times. I used it in ~1990 in code which ran on
> Z80, Multics, M68k, VAX and Cray2, and it worked without any ifdefs (for
> that, there were "just a few" for other issues like 8 vs. 9 bit char, etc).

It is not a struct on those arches, but array of structs.
Just try:
#include <stdarg.h>

void foo (int x, ...)
{
va_list ap, ap2;
va_start (ap, x);
ap2 = ap;
va_end (ap);
}
on say x86_64 or ppc32 and you'll see what I mean:
test.c:7: error: incompatible types in assignment

That's why the standard has va_copy so that you can do the
copying portably.

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