Class-related queries [was: Re: 'Undefined reference' linking errors]

Joseph Wakeling joseph.wakeling at gmail.com
Fri Apr 9 08:02:03 PDT 2010


I wrote:
> I guess I am worried about what could happen in the case of code like this in C++:
>
>     for(i=0;i<10000;++i) {
>         Foo f(i);
>         // Do something with f ...
>     }
>
> ... when it reappears in D as:
>
>     foreach(uint i;0..10000) {
>         auto f = new Foo(i);
>         // Do something with f ...
>     }

OK, I'm impressed. :-P

I did something equivalent to the above in my 'reputation' code, and ran it
through Valgrind.  No difference in number of allocs/frees between a loop of 10000
and a loop of 1.

I think I'm no longer worried. :-)


More information about the Digitalmars-d-learn mailing list