Arguments and attributes with the same name

Pelle Månsson pelle.mansson at gmail.com
Thu Mar 4 07:14:08 PST 2010


On 03/04/2010 02:44 PM, Bane wrote:
>
>> This can be solved if the compiler warns when an assignment is from a
>> variable to the same one.
>>
>> x = x; // error: assignment has no effect
>
> Nice and useful.

struct A {
     int i;
     void opAssign(A a) {
         i = a.i + 1;
     }
}

why not?



More information about the Digitalmars-d mailing list