Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OKfYg-0003KC-TP for mharc-grub-devel@gnu.org; Fri, 04 Jun 2010 18:40:10 -0400 Received: from [140.186.70.92] (port=37250 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKfYd-0003IQ-V6 for grub-devel@gnu.org; Fri, 04 Jun 2010 18:40:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OKfYc-0000sY-Mk for grub-devel@gnu.org; Fri, 04 Jun 2010 18:40:07 -0400 Received: from smarthost02.mail.zen.net.uk ([212.23.3.141]:55999) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OKfYc-0000s5-FV for grub-devel@gnu.org; Fri, 04 Jun 2010 18:40:06 -0400 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost02.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1OKfYa-0000CM-5J for grub-devel@gnu.org; Fri, 04 Jun 2010 22:40:04 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 3.36 #1 (Debian)) for grub-devel@gnu.org id 1OKfYZ-0005Ni-00; Fri, 04 Jun 2010 23:40:03 +0100 Date: Fri, 4 Jun 2010 23:40:03 +0100 From: Colin Watson To: grub-devel@gnu.org Message-ID: <20100604224002.GC21862@riva.ucam.org> References: <20100603192738.3783.6316.reportbug@rangda.seanius.net> <20100604120928.GY21862@riva.ucam.org> <4C097B95.8050605@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4C097B95.8050605@gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost02-IP: [82.69.40.219] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: Bug#584474: FTBFS: =?utf-8?q?usbms=2Ec=3A315=3A_error=3A_form?= =?utf-8?b?YXQg4oCYJTAyeOKAmSBleHBlY3RzIHR5cGUg4oCYdW5zaWduZWQgaW50?= =?utf-8?b?4oCZ?= X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 22:40:09 -0000 On Sat, Jun 05, 2010 at 12:17:57AM +0200, Vladimir 'φ-coder/phcoder' Serbinenko wrote: > On 06/04/2010 02:09 PM, Colin Watson wrote: > > As Vladimir pointed out on IRC: no, that's a minimum field width, not a > > precision. It shows *at least* two digits. > > > > I think I'd prefer to add a grub_printf length modifier to print > > grub_size_t values. 'z' is standard for size_t, so it seems reasonable > > to use that, it can be done in very little code, and it saves on ugly > > and inaccurate casts. Vladimir, what do you think? > > grub_size_t is always of the same length as long. Perhaps we should > define it as unsigned long, use "%lx" and get rid of useless difference > on 32-bit and 64-bit platforms. > Are there any reasons not to do this way? Good point; I hadn't spotted that. Mostly clarity, I think. If it comes out as unsigned long anyway then it doesn't make any difference in the machine representation, but the different definitions do seem useful for clarity. If we change that (I had to read over it a few times to convince myself), then we should comment it very carefully. A comment near the #error if GRUB_CPU_SIZEOF_VOID_P != GRUB_CPU_SIZEOF_LONG to say that we'll need to change the grub_size_t definition if we ever support an architecture where void * isn't the same length as long would also be good, I think. There is no assertion that GRUB_TARGET_SIZEOF_VOID_P == GRUB_TARGET_SIZEOF_LONG, although it's currently true for all targets. Should there be? > Alternatively %zx can be aliased to %lx in one code line. I do like being explicit about the length modifier but I understand that kern/misc.c needs to be as small as possible, so I'm not going to be precious about it. How about a compromise along the lines of C99's to reduce the probability of introducing errors when we add new targets? Following that (unfortunately ugly) pattern, we'd get something like: #define PRIxGRUB_SIZE "lx" If you think it's unlikely that grub_size_t will ever need to be anything other than unsigned long even on future targets, then maybe we don't need to worry about that. Thanks, -- Colin Watson [cjwatson@ubuntu.com]