On Tuesday, October 12, 2010 2:31:36 pm Garrett Cooper wrote:
> On Tue, Oct 12, 2010 at 5:30 AM, John Baldwin <j...@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
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to