From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 12 18:56:36 2010 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 29AE51065670 for ; Tue, 12 Oct 2010 18:56:36 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id EE0C98FC16 for ; Tue, 12 Oct 2010 18:56:35 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id A8DFB46B09; Tue, 12 Oct 2010 14:56:35 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A85838A01D; Tue, 12 Oct 2010 14:56:34 -0400 (EDT) From: John Baldwin To: Garrett Cooper Date: Tue, 12 Oct 2010 14:56:32 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010120830.19872.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201010121456.32819.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 12 Oct 2010 14:56:34 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: freebsd-hackers@freebsd.org, Jilles Tjoelker Subject: Re: [PATCH] Fix /bin/sh compilation with CFLAGS += -DDEBUG > 1 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: Tue, 12 Oct 2010 18:56:36 -0000 On Tuesday, October 12, 2010 2:31:36 pm Garrett Cooper wrote: > On Tue, Oct 12, 2010 at 5:30 AM, John Baldwin wrote: > > You should use %z to print size_t's, but even better is to just use %t > > to print a ptrdiff_t (which is the type that holds the difference of two > > pointers). > > Ok. The overall temperature of using PRI* from POSIX seems like > it's undesirable; is it just POSIX cruft that FreeBSD conforms to in > theory only and doesn't really use in practice, or is there an example > of real practical application where it's used in the sourcebase? PRI* are ugly. FreeBSD provides it so that we are compliant and so that portable code can use it, but we do not use it in our source tree because it is unreadable. > > The various changes in jobs.c should use '%td' as well rather than (int) > > casts. > > Ok. Tested build and runtime on amd64 and tested build-only with i386. Hmm, jobs.c shouldn't need any of the (ptrdiff_t) casts as the expression being printed is already a ptrdiff_t. See this non-debug code in jobs.c for example: int bgcmd(int argc, char **argv) { char s[64]; struct job *jp; ... do { ... fmtstr(s, 64, "[%td] ", jp - jobtab + 1); -- John Baldwin