[Issue 7444] Require [] for array copies too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 5 15:34:06 PST 2012


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


timon.gehr at gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timon.gehr at gmx.ch


--- Comment #1 from timon.gehr at gmx.ch 2012-02-05 15:34:04 PST ---
While I agree that the syntax should be enforced more strictly in general, I
still completely disagree with requiring [] on static array copies. Static
arrays are value types of fixed size, and should be treated as such. Requiring
[] is just wrong.

void foo(int[4] x){}
void foo(int[] y){}

void main(){
    int[4] x, y;
    struct S{int[4] x;}
    S a, b;
    x = y;
    a = b; // why should this work if the above does not?
    foo(x);   // copies, you want this to be an error
    foo(x[]); // calls the other overload, does not copy
}

-- 
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