asserts are used to check for things which are supposed to be always true in a program.
If something becomes unexpectedly false, then a debug assert is the result.
Eg.
Code:
double my_square_root ( double x ) {
assert( x >= 0 ); // can't root negatives
}
If you try and take the root of a negative number, you'll get an assert failure.
Using the debugger, track back from where the assert happened.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.