[Issue 12028] Disallow side effects in asserts

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 3 14:33:12 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12028



--- Comment #3 from bearophile_hugs at eml.cc 2014-02-03 14:33:11 PST ---
A discussion thread:
http://forum.dlang.org/thread/yzopesnnlgidhelsrrci@forum.dlang.org


A problem raised by 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.


And an answer by Marco Leise:

> Basically lock.try_acquire is pure when it returns false, and if not,
> the program is terminated anyways so it doesn't make a difference.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list