From 59e75c0f77ea1c97ce6ebe36a5bd3a7dc1125434 Mon Sep 17 00:00:00 2001 From: Shockwave Date: Sun, 4 Feb 2024 07:48:22 +0800 Subject: [PATCH] Add test_assert --- snippet/cpp/test_assert.c | 9 +++++++++ snippet/cpp/test_static.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 snippet/cpp/test_assert.c diff --git a/snippet/cpp/test_assert.c b/snippet/cpp/test_assert.c new file mode 100644 index 0000000..661f5e1 --- /dev/null +++ b/snippet/cpp/test_assert.c @@ -0,0 +1,9 @@ +#include +#include + +int main(int argc, char *argv[]) { + assert(1 > 0); + /* stop running */ + assert(1 < 0); + return 0; +} \ No newline at end of file diff --git a/snippet/cpp/test_static.c b/snippet/cpp/test_static.c index 4808f23..6093b93 100644 --- a/snippet/cpp/test_static.c +++ b/snippet/cpp/test_static.c @@ -50,7 +50,7 @@ int main(int argc, char **argv) { * Output on win64 compiled by MinGW64 gcc * addr of p: 000000B0591FFB20, addr of q: 000000B0591FFB00 */ - printf("addr of p: %p, addr of q: %p, addr of o: %p, addr of r: %p\n", + printf("addr of p: %p, addr of q: %p, addr of o: %p, addr of r: %p\n", &p, q, &o, r); free(q); free(r);