From owner-svn-src-head@FreeBSD.ORG Tue Aug 10 11:20:41 2010 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 9A0DB1065680; Tue, 10 Aug 2010 11:20:41 +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 2DFC78FC13; Tue, 10 Aug 2010 11:20:40 +0000 (UTC) Received: from c122-106-147-41.carlnfd1.nsw.optusnet.com.au (c122-106-147-41.carlnfd1.nsw.optusnet.com.au [122.106.147.41]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7ABKRKV019893 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Aug 2010 21:20:27 +1000 Date: Tue, 10 Aug 2010 21:20:27 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: "M. Warner Losh" In-Reply-To: <20100809.095007.4959786895405928.imp@bsdimp.com> Message-ID: <20100810210449.H10110@delplex.bde.org> References: <20100808.153608.1142818667055052395.imp@bsdimp.com> <20100808220631.GA86477@stack.nl> <86tyn4tbuc.fsf@ds4.des.no> <20100809.095007.4959786895405928.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-2134441558-1281439227=:10110" Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@fromme.com, svn-src-head@FreeBSD.org, des@des.no Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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: Tue, 10 Aug 2010 11:20:41 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-2134441558-1281439227=:10110 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Mon, 9 Aug 2010, M. Warner Losh wrote: > In message: <86tyn4tbuc.fsf@ds4.des.no> > Dag-Erling Sm=F8rgrav writes: > : Jilles Tjoelker writes: > : > In other cases, I propose adding a cast to void * in between, like > : > (struct sockaddr_in *)(void *)ai->ai_addr > : > : Better to cast through uintptr_t. Perhaps we should have a > : __DECONST-like macro for this? > : > : #define __ALIGNED_CAST(t, v) ((t)(uintptr_t)(v)) __DECONST() shouldn't exist, and this would be another way to break the warning. > I like the idea of a macro. Why is a cast through uintptr_t better? The bugs in __DECONST() are larger than its existence: - first, the (const void *) cast in it fails if that cast would cast away qualifiers (mainly the volatile qualifier). Perhaps (volatile const void *) would work better. - next, the `(type)' cast in it fails unless `type' is precisiely `void *' or perhaps a qualified variant of that (since [u]intptr_t only has defin= ed behaviour if [u]intptr_t exists and is applied to a `void *'). Casting through only uintptr_t is better because it fails in more cases, (as for `(type)' above, but also for converting uintptr_t), and anything that prevents use of bogus casts by making them fail is better :-). Bruce --0-2134441558-1281439227=:10110--