John Regehr on "Use of Assertions"

Trass3r un at known.com
Mon Sep 3 20:46:02 UTC 2018


On Sunday, 2 September 2018 at 21:12:39 UTC, Nick Sabalausky 
(Abscissa) wrote:
> This does make me think of one thing: Shouldn't assert 
> expressions be required to be pure? (even if only weakly pure)
>
> Not sure how much practical problems that would create, but at 
> least in theory it certainly sounds like the right thing.

Exactly. You may still catch assert(!fclose(f)) but not other 
non-obvious functions.
Nice trick to find them in C:
https://stackoverflow.com/questions/10593492/catching-assert-with-side-effects/35294344#35294344


More information about the Digitalmars-d mailing list