I can't find anything on the legality of pulling an unpromoted type
out of va_arg. However, it's obvious that pulling the promoted type
can *never* be wrong, so it's safer.
For reference, glibc's vfprintf has code like:
else /* `short int' will be promoted to `int'. */
signed_number = va_arg (ap, int);
and
number.word = (unsigned short int) va_arg (ap, unsigned int);
> But I _really_ don't want to just silently drop a documented feature.
Reread patch; I'm not dropping it. Ignoring the `h' qualifier is the
right thing to do except in the already-broken case of an actual int,
eg:
printk("%hu", 65536);
> Why is it broken on ppc/sparc? I assume it's because they have the wrong
> byte order, but why does this bite only the Linux kernel - it should have
> bitten other things too?
I've been bitten years ago; nowadays I always pull the promoted type
out of varargs. Seems I'm not alone.
Rusty.
-- .sig lost in the mail.- 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/