[Issue 7664] Problem with fixed-sized associative array key assignment

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 24 10:25:39 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7664



--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2012-03-24 10:26:02 PDT ---
(In reply to comment #2)
> Thank you for your answers. I convert this to enhancement request then.
> 
> I think such constant-folding is useful to remove some run-time tests and speed
> up other code that uses slices.

In really special case, D allows such conversion from dynamic array type to
static array type. See following:

void foo(immutable(char)[4] s){}
void main()
{
    static assert(is(typeof("test") == immutable(char)[]));
    foo("test");            // immutable(char)[] to immutable(char)[4]
    foo(['t','e','s','t']); // immutable(char)[] to immutable(char)[4]
}

So there seems to be enough reasoning for this enhancement.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list