Strict aliasing in D

Denis Shelomovskij verylonglogin.reg at gmail.com
Sun Jul 28 22:05:54 PDT 2013


27.07.2013 12:59, Walter Bright пишет:
> On 7/27/2013 1:57 AM, David Nadlinger wrote:
>> On Saturday, 27 July 2013 at 06:58:04 UTC, Walter Bright wrote:
>>> Although it isn't in the spec, D should be "strict aliasing". This is
>>> because:
>>>
>>> 1. it enables better code generation
>>>
>>> 2. there are ways, such as unions, to get the other aliasing that
>>> doesn't
>>> break strict aliasing
>>
>> We need to carefully formalize this then, and quickly. The problem
>> GCC, Clang
>> and others are facing is that (as you are probably aware) 2. isn't
>> guaranteed to
>> work for type-casting pointers either by the specs, but people want to
>> be able
>> to do this nonetheless.
>>
>> Thus, they both accept pointer aliasing through union types, trying to
>> optimize
>> as much as possible while avoiding to break people's expectations and
>> existing
>> code. This is a very unfortunate situation for both compiler
>> developers and
>> users; just search for something like "gcc strict aliasing" on
>> StackOverflow for
>> examples.
>>
>> There is already quite a lot of D code out there that violates the
>> C-style
>> strict aliasing rules.
>
> I agree. Want to do an enhancement request on bugzilla for it?
>

So is enhancement request filed?

-- 
Денис В. Шеломовский
Denis V. Shelomovskij


More information about the Digitalmars-d mailing list