What's wrong with just a runtime-checked const?

Reiner Pope reiner.pope at gmail.com
Tue Jul 18 04:03:32 PDT 2006


> Hmm, afaik, unit tests are only run once per execution and don't 
> otherwise affect the speed of execution. Their size also depends on the 
> size of the code, but keeping runtime constness information would have 
> costs depending on the size of _data_, a much bigger problem I think...

I also meant DbC preconditions and postconditions, which I believe are 
only compiled in during debug mode. These are run at every function 
invocation, which can mean a big slow-down (especially with long 
invariants).

> 
> And sure, you need to worry about efficiency. Something like a 10% speed 
> loss is probably acceptable, but something that will slow your program 
> by a factor of 20 is often not acceptable, even in debug builds...

Since no implementation has been done, we can only wildly speculate 
about slow-downs. Since it's all getting very confused, I'll work out 
the details gradually and see if I come across any more problems, and 
then post my results here.

Reiner

> 
> 
> xs0



More information about the Digitalmars-d-learn mailing list