std.string.translate using initializing twice?

Jonathan M Davis jmdavisprog at gmail.com
Mon Aug 9 17:59:01 PDT 2010


On Monday, August 09, 2010 17:45:07 simendsjo wrote:
> translate does this:
>      bool[256] deltab; // this would make all values of deltab false as
> bool.init == false, right?
> 
>      deltab[] = false;
> 
> Isn't this just initializing all values of deltab to false twice..?

I believe that you are correct and that the array is getting set twice.

>  [snip]...

I confess that it's entirely irrational on my part given that D is smart enough 
that a post-increment where the temporary is not used should be just as efficient 
as a pre-increment (even in the face of operator overloading - unlike C++), but 
it always makes me cringe to see post-increments where a pre-increment would 
do...

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list