zhangmeng
2024-04-09 2561a007b8d8999a4750046d0cfb3b1ad5af50ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
#include <iostream>
// uncomment to disable assert()
// #define NDEBUG
#include <cassert>
 
// Use (void) to silent unused warnings.
#define assertm(exp, msg) assert(((void)msg, exp))
 
int main()
{
    assert(2+2==4);
    std::cout << "Execution continues past the first assert\n";
    // assertm(2+2==5, "There are five lights");
    // std::cout << "Execution continues past the second assert\n";
    assert((2*2==4) && "Yet another way to add assert message");
    assert(("There are five lights", 2 + 2 == 5));
}