On Saturday 20 January 2007 20:32, Alexander Leidinger wrote: > Quoting FreeBSD Tinderbox <tinderbox_at_freebsd.org> (Sat, 20 Jan 2007 13:22:10 -0500 (EST)): > > /src/sys/compat/linprocfs/linprocfs.c: In function > > `linprocfs_doprocstat': /src/sys/compat/linprocfs/linprocfs.c:478: > > warning: int format, different type arg (arg 3) *** Error code 1 > > Does someone has a table of common 32/64 bit printf issues and the > corresponding DTRT handling of the issues? To fix this I used something > which I did found somewhere in the kernel, but I'm not sure if it is > the best way to fix it. I could have casted it to int instead of > keeping the precision sizeof() is offering (casting to intmax_t and > using a different printf format type). At this place this would have > been enough. The root of the problem is that we have different typedefs for (u_)int64_t in 32 and 64 bit archs. Specifically, we use "(unsigned) long" on 64 bit archs while 32 bit archs use "(unsigned) long long". As intmax_t is an alias for int64_t this means also that intmax_t is "shorter" (for some definition) than "long long". I still think that we should make it "long long" on all archs as Net- and OpenBSD do. There are the dreaded PRI... macros that are supposed to fix this, but that is really ugly. In general, a cast to intmax_t and %j or long long and %ll seems to be the preferred sollution. -- /"\ Best regards, | mlaier_at_freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier_at_EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:05 UTC