Zero-length static array spec

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 7 07:04:42 PST 2015


On 7 Feb 2015 12:50, "David Nadlinger via Digitalmars-d" <
digitalmars-d at puremagic.com> wrote:
>
> On Saturday, 7 February 2015 at 12:10:45 UTC, Iain Buclaw wrote:
>>
>> Some cod scenarios:
>> 1. Comparisons of == fold into 'false'  (unless comparing to self)
>> 2. Comparisons of != fold into 'true'  (unless comparing to self)
>> 3. Conversion to dynamic arrays is { .length=0, .ptr=&arr0 }
>
>
> What does "arr0" refer to?
>

A zero length static array.

> And assuming that a0.ptr and a1.ptr would end up being the same in your
proposal, do you really want to have a situation where a0.ptr == a1.ptr &&
a0.length == a1.length but a0 != a1?
>
> David

a0.ptr == a1.ptr  // false, enforced by compiler. Comparison not actually
emitted.
a0.length == a1.length // true, both are 0
a0 != a1  // true, same effect as first.

Iain.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150207/2fec1999/attachment.html>


More information about the Digitalmars-d mailing list