The following is a quote from a comment in the Reddit post about asserts
that Walter just linked to:
"Asserts are not without pitfalls, though. If you aren't careful,
what to put in the asserts, the program could behave differently"
A trivial example of this is:
int i;
write(i
Lars T. Kyllingstad:
> Would it be possible (and desirable) for the D compiler to statically
> check that asserts have no side effects?
Only pure asserts?
If you put:
assert (++i == 1);
Inside a function precondition, it gets removed in release mode.
Bye,
bearophile
On Mon, 30 Nov 2009 13:52:48 +0300, Lars T. Kyllingstad
wrote:
The following is a quote from a comment in the Reddit post about asserts
that Walter just linked to:
"Asserts are not without pitfalls, though. If you aren't careful,
what to put in the asserts, the program could beh
On Nov 30, 09 19:15, Denis Koroskin wrote:
On Mon, 30 Nov 2009 13:52:48 +0300, Lars T. Kyllingstad
wrote:
The following is a quote from a comment in the Reddit post about
asserts that Walter just linked to:
"Asserts are not without pitfalls, though. If you aren't careful,
what to put in the a
On Mon, 30 Nov 2009 15:46:45 +0300, KennyTM~ wrote:
On Nov 30, 09 19:15, Denis Koroskin wrote:
On Mon, 30 Nov 2009 13:52:48 +0300, Lars T. Kyllingstad
wrote:
The following is a quote from a comment in the Reddit post about
asserts that Walter just linked to:
"Asserts are not without pitfal
Denis Koroskin wrote:
On Mon, 30 Nov 2009 15:46:45 +0300, KennyTM~ wrote:
On Nov 30, 09 19:15, Denis Koroskin wrote:
On Mon, 30 Nov 2009 13:52:48 +0300, Lars T. Kyllingstad
wrote:
The following is a quote from a comment in the Reddit post about
asserts that Walter just linked to:
"Asserts
bearophile wrote:
Lars T. Kyllingstad:
Would it be possible (and desirable) for the D compiler to statically
check that asserts have no side effects?
Only pure asserts?
Like Denis said, pure is a bit too strict. One just wants to make sure
that the assert doesn't *change* any variables. It