Passing array as const slows down code?

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Fri Apr 27 12:28:48 PDT 2012


On 27/04/12 20:39, Steven Schveighoffer wrote:
> No, just make sure all the parameters and the result are either immutable or
> implicitly castable to immutable (hard to explain this better).
>
> Hm... gives me a thought that unit tests should have a helper that allows
> ensuring this:
>
> static assert(isStrongPure!fn);
>
> Or maybe __traits(isStrongPure, fn) if it's too difficult to do in a library.

Not worth adding a strongpure (purest?) attribute to enable coders to explicitly 
mark their expectations?

> array bounds checks and asserts are turned off during -release compilation :)

Maybe I've misunderstood what that means, but I would still have expected the 
program to stop running at least.  What was it doing instead ... ? :-)


More information about the Digitalmars-d-learn mailing list