Date: Tue, 12 Oct 2010 14:56:32 -0400 From: John Baldwin <jhb@freebsd.org> To: Garrett Cooper <yanegomi@gmail.com> Cc: freebsd-hackers@freebsd.org, Jilles Tjoelker <jilles@stack.nl> Subject: Re: [PATCH] Fix /bin/sh compilation with CFLAGS += -DDEBUG > 1 Message-ID: <201010121456.32819.jhb@freebsd.org> In-Reply-To: <AANLkTimq55BsTuKvFq7WHXKxtGk=Ny7L3JJ9fzOyOgDT@mail.gmail.com> References: <AANLkTinHi6jaLY%2BbZdnhL=gEY3hWGrzcfFG8nO6VMc5n@mail.gmail.com> <201010120830.19872.jhb@freebsd.org> <AANLkTimq55BsTuKvFq7WHXKxtGk=Ny7L3JJ9fzOyOgDT@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, October 12, 2010 2:31:36 pm Garrett Cooper wrote: > On Tue, Oct 12, 2010 at 5:30 AM, John Baldwin <jhb@freebsd.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010121456.32819.jhb>