On 7/30/2014 2:12 AM, bearophile wrote:
The optimizer can certainly use asserts to provide semantic information (even
though the dmd one doesn't at the moment).

This is not a good idea. That's the job for assume(), not for assert.

The two are without distinction.


In general assert() verifies something is true, and if it's false, the program
just raises an assert error, that is even recoverable.

No, it is not recoverable.


assert() can be used freely in your code, to make sure you have not done a
mistake. assume() is only for special situations where you know something is
true, that the compiler can't prove by itself.

Again, everything you say is true for assume is true for assert, and vice versa.

Reply via email to