From owner-freebsd-hackers@FreeBSD.ORG Sun May 17 16:41:17 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53E6D106566C for ; Sun, 17 May 2009 16:41:17 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id A97308FC0C for ; Sun, 17 May 2009 16:41:16 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 17 May 2009 16:41:14 -0000 Received: from p54A3C65F.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.198.95] by mail.gmx.net (mp013) with SMTP; 17 May 2009 18:41:14 +0200 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX1+o+HElkfOoTEFe1Q0D+Wm8VyIGBTu9VUr+YqfSCk rnta1kESQsmGyD Message-ID: <4A103E29.4040309@gmx.de> Date: Sun, 17 May 2009 18:41:13 +0200 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.21 (X11/20090412) MIME-Version: 1.0 To: Stanislav Sedov References: <49F4070C.2000108@gmx.de> <20090428114754.GB89235@server.vk2pj.dyndns.org> <49FAE4EA.1010205@gmx.de> <20090517144516.331b01a8.stas@FreeBSD.org> <4A1004B3.5040805@gmx.de> <20090517200456.cefa04fb.stas@FreeBSD.org> In-Reply-To: <20090517200456.cefa04fb.stas@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.58 Cc: FreeBSD Hackers Subject: Re: C99: Suggestions for style(9) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 May 2009 16:41:17 -0000 Stanislav Sedov schrieb: > On Sun, 17 May 2009 14:36:03 +0200 > Christoph Mallon mentioned: > >>> Aliasing behavior is stritcly described in >>> ISO C99 standard, so there's a good point to enforcing strict-aliasing clear >>> code in our kernel. >> If you like this addition because of this reason, I have to disappoint >> you: This addition has absolutly *nothing* to do with strict-aliasing. >> > > I didn't meant I like this change only from aliasing point of view: certianly, > the code readability argument is very important. But this change also > works towards the strict aliasing problem solving too: there's just > a less chance someone will reuse a variable, address of which was > previously taken. Something like this would violate strict-aliasing: int i; short* p = (short*)&i; A short pointer may never point at an int object (ISO/IEC 9899:1999 (E) §6.5:7). The suggested paragraph has nothing to do with strict-aliasing. It's "just" about reusing the same variable in different contexts. Reusing the same variable in different contexts is bad, because it's harder for a human reader to identify the def-use-chains and additionally if the address of the variable has escaped (just a "normal" alias problem, nothing about type-punning and strict-aliasing) the generated code will be worse. Please, can we stop this now? It was already rejected. It's a pity, but maintaining status quo for style(9) seems to be too holy. *sigh* Christoph