Re: The great alpha compile warning hunt

Albert D. Cahalan (acahalan@cs.uml.edu)
Sat, 24 Jul 1999 13:55:54 -0400 (EDT)


[various people]

>> You cast to an unsigned int: (unsigned)sizeof(foo)
>
> I don't think this is the right way. Either you keep the full 64
> bits, or you lose valuable debugging info that the printk was put

There is no way the printk() will ever be called. If the sizeof()
operator returns a result that won't fit in 32 bits, you will need
over 4 GB to boot your kernel. Your compile will most likely fail.

> Firstly, I don't think "printk" latency is a real performance

It is microscopic, but why pay it for zero benefit?

> issue (also my patch doesn't add overhead). Secondly, I don't think
> an extra character in the format string is a loss compared with doing

same as above, but this is worse

>> This is not good. Every printk() with the problem ends up with
>> an extra character in the format string and possibly extra overhead.
>> For what? So you can have a 5 GB structure in kernel space?
>
> So you can see when the top half of a 64 bit pointer has been trashed.

If the top half of sizeof() gets trashed, your compiler is broken.
The compiler will crash. You should report this to the gcc maintainers.

BTW, one should use %p for pointers, not %zd.

If it is the explicit cast you object to, you can try this hack:
#define sizeof (unsigned)sizeof

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