input validation

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Mar 4 10:27:55 PST 2009


Max Samukha wrote:
> 
> If you intruduce a dummy type, why not make it perform validation in a
> debug build when sumthing like debug=slowButSafe is set?

Because in the case of binarySearch slowButSafe quickly becomes 
slowAndUseless. It's happened to me - I had an assert(isSorted) in 
binary search (I guess it's in one of the older phobos releases!) and 
when I was using the debug version, my program would take forever to run.

A debug build should at most change the constant multiplying the 
complexity, not the complexity.


Andrei



More information about the Digitalmars-d mailing list