Subject: Re: printf(3) bug with %ld and %d?
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: None <tlaronde@polynum.com>
List: tech-userlevel
Date: 10/30/2006 12:06:22
On Mon, Oct 30, 2006 at 12:11:47AM -0500, der Mouse wrote:
>
> %ld is the wrong format to use for off_t. i386 long is 32 bits, but
> off_t is 64 bits. Use (long int)offset in the printf calls and it'll
> make a lot more sense to you.
>
> The actual arglists are
>
> string, n, offset (low half), offset (high half)
> and
> string, offset (low half), offset (high half), n
>
> (low half first because you're on i386, which is little-endian). In
> the former case, the extra 32 bits are ignored; in the latter case,
> they are consumed by the "integer after" format, and the n value is
> ignored.
Thank you very much for the detail explanations! I _did_ miss
something...
Regards,
--
Thierry Laronde (Alceste) <tlaronde +AT+ polynum +dot+ com>
http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C