From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 18 18:14:54 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C74F1065676 for ; Thu, 18 Sep 2008 18:14:54 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from QMTA08.emeryville.ca.mail.comcast.net (qmta08.emeryville.ca.mail.comcast.net [76.96.30.80]) by mx1.freebsd.org (Postfix) with ESMTP id 167228FC1D for ; Thu, 18 Sep 2008 18:14:53 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from OMTA07.emeryville.ca.mail.comcast.net ([76.96.30.59]) by QMTA08.emeryville.ca.mail.comcast.net with comcast id GG4U1a00B1GXsucA8JEtDA; Thu, 18 Sep 2008 18:14:53 +0000 Received: from koitsu.dyndns.org ([67.180.253.227]) by OMTA07.emeryville.ca.mail.comcast.net with comcast id GJEq1a00G4v8bD78TJEqoD; Thu, 18 Sep 2008 18:14:51 +0000 X-Authority-Analysis: v=1.0 c=1 a=TxRg_kTAMXoA:10 a=MqYcG8XZC70A:10 a=QycZ5dHgAAAA:8 a=aDGiwOg0AIS5PVnGsCwA:9 a=-G9UrD02IaQjmnaTEwsSCIAtmhUA:4 a=EoioJ0NPDVgA:10 a=LY0hPdMaydYA:10 Received: by icarus.home.lan (Postfix, from userid 1000) id 2A08417B822; Thu, 18 Sep 2008 11:14:50 -0700 (PDT) Date: Thu, 18 Sep 2008 11:14:50 -0700 From: Jeremy Chadwick To: Steve Franks Message-ID: <20080918181450.GA24440@icarus.home.lan> References: <539c60b90809181041n658d2823y89e42bb0ccfa6d06@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <539c60b90809181041n658d2823y89e42bb0ccfa6d06@mail.gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: freebsd-hackers Subject: Re: proper types for printf()-ing pointers on amd64 that won't break i386? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Sep 2008 18:14:54 -0000 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 |