I am trying to understand how to use Ensures()
in code. As given in the example, if I tried using Ensures()
as follows...
int main(void)
{
int result = 0;
// Some calculation
Ensures(result == 255);
return 0;
}
If the result
variable is not equal to 255
, the program crashes with the following output "terminate called without an active exception"
. My question is how to use Ensures()
properly?
std::terminate
is called in your example, then it works as is should. – Gare