shorter alternative of constructor with parameter

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 22 00:36:16 PDT 2014


SomeDude:

> I've never seen a single instance of a bug like this in 15 years
> of Java and C++ programming. One has to be really sloppy in 
> order to insert bugs in such simple code.

Do you mean bugs like this?

class Foo {
     int x;
     this(int x_) {
         x = x;
     }
}

I have had some of them, found and fixed quickly. I think they 
are sufficiently common (unless you have an IDE that generates 
that boilerplate for you).

Bye,
bearophile


More information about the Digitalmars-d mailing list