Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 May 2009 18:41:13 +0200
From:      Christoph Mallon <christoph.mallon@gmx.de>
To:        Stanislav Sedov <stas@FreeBSD.org>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: C99: Suggestions for style(9)
Message-ID:  <4A103E29.4040309@gmx.de>
In-Reply-To: <20090517200456.cefa04fb.stas@FreeBSD.org>
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>

next in thread | previous in thread | raw e-mail | index | archive | help

Stanislav Sedov schrieb:
> On Sun, 17 May 2009 14:36:03 +0200
> Christoph Mallon <christoph.mallon@gmx.de> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A103E29.4040309>