On Tue, May 31, 2011 at 03:28:45PM +0100, Ben Laurie wrote: > On 18/05/2011 22:16, Pawel Jakub Dawidek wrote: > > On Wed, May 18, 2011 at 09:06:20PM +0000, Ben Laurie wrote: > >> Author: benl > >> Date: Wed May 18 21:06:20 2011 > >> New Revision: 222084 > >> URL: http://svn.freebsd.org/changeset/base/222084 > >> > >> Log: > >> Fix clang warnings. > >> > >> Approved by: philip (mentor) > > [...] > >> - fprintf (stderr, " by changing asso_value['%c'] (char #%d) to > >> %d\n", > >> + fprintf (stderr, " by changing asso_value['%c'] (char #%zd) > >> to %d\n", > >> *p, p - union_set + 1, asso_values[(unsigned > >> char)(*p)]); > > > > Hmm, both 'p' and 'union_set' are 'char *' and %zd is for ssize_t. It is > > a bit strange that it fixes the warning. > > Why? The difference between two pointers is ssize_t, surely? >
>From n1256.pdf, When two pointers are subtracted, both shall point to elements of the same array object, or one past the last element of the array object; the result is the difference of the subscripts of the two array elements. The size of the result is implementation-defined, and its type (a signed integer type) is ptrdiff_t defined in the <stddef.h> header. ptrdiff_t is not necessarily that same as ssize_t. -- Steve _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"