[dmd-internals] Testcase in test42.d

David Nadlinger code at klickverbot.at
Fri Apr 5 14:16:11 PDT 2013


On 5 Apr 2013, at 22:23, Walter Bright wrote:
> On 4/5/2013 12:24 PM, David Nadlinger wrote:
>> On 5 Apr 2013, at 21:16, Walter Bright wrote:
>>> I am reluctant to change that, because it would break existing code.
>>
>> Change what? As far as I can see, the test case and any code that 
>> relies on that behavior is simply invalid given the "like the host C 
>> compiler" clause. Chances are that any such "existing" code doesn't 
>> work (reliably) on GDC and LDC today.
>>
>> If you want different behavior, you *do* have to change the spec.
>
> This behavior was a frequent request from those doing SIMD code, which 
> is why it's there, and why I'm reluctant to remove it and break their 
> code.

Sorry, but I don't think this is a sensible argument at all. We can 
either
   1) decide that static arrays should be aligned to some special number 
of bytes, and adapt the spec accordingly, addressing any issues like C 
ABI compatibility
— or —
   2) remove the (invalid) unit test, and ask any people relying on this 
undocumented feature to adapt their code.

Doing nothing is certainly not an option.

I'd argue that 2) is the better choice – isn't just using vector types 
(e.g. core.simd.int4) for storage the best idea in cases where you want 
to, well, use the data in vector operations?

In related news, I think that telling people that it is okay to rely on 
undocumented DMD implementation quirks is jeopardizing the future of D 
in more ways than you might realize, and certainly sends all the wrong 
signals to people working on alternative implementations.

David


More information about the dmd-internals mailing list