Date: Thu, 18 Sep 2008 11:14:50 -0700 From: Jeremy Chadwick <koitsu@FreeBSD.org> To: Steve Franks <stevefranks@ieee.org> Cc: freebsd-hackers <freebsd-hackers@freebsd.org> Subject: Re: proper types for printf()-ing pointers on amd64 that won't break i386? Message-ID: <20080918181450.GA24440@icarus.home.lan> In-Reply-To: <539c60b90809181041n658d2823y89e42bb0ccfa6d06@mail.gmail.com> References: <539c60b90809181041n658d2823y89e42bb0ccfa6d06@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Sep 18, 2008 at 10:41:42AM -0700, Steve Franks wrote: > I'm trying to correct some warnings in a port marked > ONLY_FOR_ARCHS=i386. They stem from casting a pointer (which I assume > is a 64-bit unsigned) to "unsigned int" which is apparently 32 bits? > I sort of thought int was supposed to be the atomic register size, but > no doubt that would break more than it would help, so it's 32-bits. > Anyways, what's the right way to fix this? The port actually works > fine as-is on amd64, so I can only assume something was fixed for 7.1, > or someone was being extra cautious with the i386 tag. > > The code: > > typedef unsigned int cardinal; > ... > fprintf(stderr, "Mode Table Offset: $C0000 + $%x\n", > ((cardinal)map->mode_table) - ((cardinal)map->bios_ptr)); > > Can I just ditch the cast+%x and use %p? I don't have an i386 system > to test on, and I don't want to break anything if I submit a patch... Yes, use %p! It works fine on all platforms. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080918181450.GA24440>