status of D optimizers benefiting from contracts ?
    Kagamin via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Tue Nov 11 06:50:09 PST 2014
    
    
  
On Monday, 10 November 2014 at 10:27:19 UTC, bearophile wrote:
> In practice I prefer to avoid using hacks like setting a 
> NDEBUG. It's better to have differently named operators if 
> their behavour is different. So it's better to keep the 
> assert() as it is commonly used (and I'd like it to refuse a 
> not pure expression). And add another operator, like 
> strong_assert() for the NDEBUG=strong behavour. (And if you 
> can't live with it, you can also add a strict_assert()). 
> Changing the behavour of asserts just changing a global 
> constant is silly because what matters is the semantics the 
> programmer gives to the assert he/she/shi is using. So giving 
> them different names is much better.
In my experience asserts don't show such distinction, and it's 
impractical to decide such things in advance. So I think, a 
compiler switch makes more sense.
    
    
More information about the Digitalmars-d-learn
mailing list