Disallow side effects in assert

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Mon Feb 3 18:10:17 PST 2014


On Monday, 3 February 2014 at 14:57:19 UTC, bearophile wrote:
> Two simple examples of code that is meant to be forbidden:
>
> int foo(ref int y) pure nothrow {
>     return y++;
> }
> void main() {
>     int x;
>     assert(++x);
>     assert(foo(x));
> }
>
> Bye,
> bearophile

Aren't these things you might do inside a unittest?


More information about the Digitalmars-d mailing list