| Summary: | printf does the wrong thing when given a 64-bit long | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | David Geib <dgeib> |
| Component: | [OLD] Core system | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
| Status: | RESOLVED INVALID | ||
| Severity: | normal | ||
| Priority: | High | ||
| Version: | 2006.1 | ||
| Hardware: | AMD64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
has nothing to do with coreutils afaict you should really build with warnings enabled (-Wall) then you should read the printf(3) manpage %x takes an unsigned int and since you did not include any length modifiers, printf() only shows (unsigned int)(0x0123456789abcdef) which correctly evaluates to 0x89abcdef |
david@localhost ~ $ cat test64.c #include<stdio.h> int main() { long i = 0x0123456789abcdef; printf("%d bit long: %x\n", 8*sizeof(i), i); } david@localhost ~ $ gcc test64.c -o test64 david@localhost ~ $ ./test64 64 bit long: 89abcdef