against enforce

Kagamin spam at here.lot
Sat Mar 26 05:14:19 PDT 2011


Steven Schveighoffer Wrote:

> For example, if I do:
> 
> sqrt(1);
> 
> There is never ever a need to test this in production code.  sqrt(1) is  
> always 1, and will always work.
> 
> If I do:
> 
> sqrt(-1);
> 

pure function called on literals is evaluatable at compile time together with checks, so if sqrt run at runtime, this means input couldn't be validated that easily, so checks should be run too. This means that it's unnecessary to ever remove checks from sqrt.


More information about the Digitalmars-d mailing list