From owner-svn-src-head@FreeBSD.ORG Wed Jun 1 09:25:08 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC6461065670; Wed, 1 Jun 2011 09:25:08 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 650E08FC15; Wed, 1 Jun 2011 09:25:08 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p519P3XS007390 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 1 Jun 2011 19:25:05 +1000 Date: Wed, 1 Jun 2011 19:25:03 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Steve Kargl In-Reply-To: <20110531153254.GA55855@troutmask.apl.washington.edu> Message-ID: <20110601191732.A1211@besplex.bde.org> References: <201105182106.p4IL6KkE008657@svn.freebsd.org> <20110518211651.GE2273@garage.freebsd.pl> <4DE4FB1D.8090407@links.org> <20110531153254.GA55855@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek , Ben Laurie Subject: Re: svn commit: r222084 - head/contrib/gperf/src X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2011 09:25:08 -0000 On Tue, 31 May 2011, Steve Kargl wrote: > 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 > header. > > ptrdiff_t is not necessarily that same as ssize_t. ssize_t doesn't even exist in Standard C. It is a POSIX thing, mainly for the (broken for historical reasons) return type of read(2) and similar functions. Bruce