Disallow side effects in assert

bearophile bearophileHUGS at lycos.com
Mon Feb 3 11:05:04 PST 2014


Brad Roberts:

> I have one semi-large code base where I validate the locking 
> semantics by adding assert(!lock.try_acquire)'s.  That's 
> clearly a side effect, but also clearly should never have one 
> if the code is correct.

I see, and you can't you use a special library-defined assert for 
that purpose.

Bye,
bearophile


More information about the Digitalmars-d mailing list