printk can't display %d, but can display %u, %x, ......, why?

From: xuhaoz
Date: Fri Sep 24 2004 - 02:42:08 EST



Hi:

Yesterday, I found a strangeous problem that printk in my OS can't print %d format number, but can print %u, %x ...

why?

let's see an example:

unsigned int memsize;

memsize=64;

printk("memsize unknown: setting to %dMB\n",memsize);

if I use %d to display, the result of memsize is -18446744073709551552MB

printk("memsize unknown: setting to %uMB\n",memsize);

if I use %u to display ,the result of memsize is 64MB

Would you please tell me what leads to this problem?

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