From owner-svn-src-all@FreeBSD.ORG Wed May 23 10:46:31 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 68A231065673; Wed, 23 May 2012 10:46:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id CA4838FC0A; Wed, 23 May 2012 10:46:30 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q4NAkPCK014082 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 23 May 2012 20:46:26 +1000 Date: Wed, 23 May 2012 20:46:25 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Garrett Cooper In-Reply-To: Message-ID: <20120523203051.J1464@besplex.bde.org> References: <201205221818.q4MII7lk019626@svn.freebsd.org> <20120523050739.H3621@besplex.bde.org> <4FBC86B3.8020105@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: "mdf@FreeBSD.org" , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , Dimitry Andric , "David E. O'Brien" , BruceEvans , "svn-src-head@freebsd.org" Subject: Re: svn commit: r235797 - head/contrib/gcc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2012 10:46:31 -0000 On Wed, 23 May 2012, Garrett Cooper wrote: > On May 22, 2012, at 11:41 PM, Dimitry Andric wrote: > >> On 2012-05-22 23:07, mdf@FreeBSD.org wrote: >> ... >>> We run with the following at Isilon, which is somewhat bogus because >>> it allows a bit of sloppiness in types, but is also terribly >>> convenient since it means no casting on printf arguments is needed: >> >> Please don't. If you want to write portable code, use the (admittedly >> horrible) PRId64 macros instead. Please don't. The PRI macros are almost as abominable as long long. > Agreed, because the patch attached earlier disguises issues with signedness (for one) and I've seen some interesting bugs creep in because of issues like that, an it's painful cleaning up those problems later on (esp. considering that clang will replace gcc not too far down the line)... Disagreed (except I always notice sign errors in printf formats too. I once fixed -Wformat to detect sign errors, but ran away since it found even more sign errors than size errors. Now I only notice the sign errors when a size error turns up). Apart from being even uglier looking than long long, the PRI macros are not even usable for printing an averaged typedefed type, since unless there is a format letter and a corresponding PRI macro for just that type, you have to peer inside the opaque details of the type to determine its size and perhaps its signedness and then hard-code the corresponding PRI macro. This breaks as soon as the opaque details change and thus defeats the point of having (semi-)opaque typedefed types. If a variable's type is known to be 64 bits, then you can hard-code PRI64 for it. This breaks as soon as the knowledge becomes out of date. Since the type isn't typedefed, it is less likely to change, but there is no guarantee. Everyone knew that all types were 32 bits and had to change too much to support 64 bit systems. Bruce