Why is this allowed
    JN 
    666total at wp.pl
       
    Tue Jun 30 16:22:57 UTC 2020
    
    
  
Spent some time debugging because I didn't notice it at first, 
essentially something like this:
int[3] foo = [1, 2, 3];
foo = 5;
writeln(foo);   // 5, 5, 5
Why does such code compile? I don't think this should be 
permitted, because it's easy to make a mistake (when you wanted 
foo[index] but forgot the []). If someone wants to assign a value 
to every element they could do foo[] = 5; instead which is 
explicit.
    
    
More information about the Digitalmars-d-learn
mailing list