On 7/29/2014 3:02 PM, Timon Gehr wrote:
They are dual concepts. Assert demands a property to hold, assume provides a
property that holds.
A distinction without a difference. potayto, potahto
1. This particular behaviour is characteristic for an assumption, not an
assertion, according to the above characterisation, which is standard in certain
communities, like people who are into verification of procedural programs.
2. Code containing such a construct must in general be monitored to ensure
memory safety, hence can at most be @trusted.
??
I was just pointing out how to properly prevent optimization based on disabled
assertions.
??
(Unless, of course, you want to tell me a compiler may assume that anything in a
version(assert) block can be assumed to actually be part of the program by the
optimizer, which is very hard to implement, and may not even make sense in all
circumstances.
I don't know what you're assuming (!) the version(assert) even does, as it is
not a language feature.
BTW what about the following gem?
version(assert){}
else int x=2;
assert({
static if(is(typeof(x))) enum e=loopForever();
return someExpression;
}());
Should I expect it to stall compilation starting from a certain optimization
level in -release mode, or what should be going on here?)
??
I hope this post cleared it up a little.
Not a bit. The distinction utterly escapes me.