📄 assert_removed.h.svn-base
字号:
// assert.h is a bad name -- it collides with standard header and// under certain settings gets included from <cassert>// a C++ exception-throwing <assert.h> replacement.#ifndef __WHALE__ASSERT_H#define __WHALE__ASSERT_H#undef _ASSERT_H#define _ASSERT_H // to prevent standard assert.h inclusion#include <iostream>class FailedAssertion{public: int line; char *fn; char *condition; FailedAssertion(int supplied_line, char *supplied_fn, char *supplied_condition) { line=supplied_line; fn=supplied_fn; condition=supplied_condition; }};#undef assert#ifdef NDEBUG #define assert(condition) (condition ? true : false)#else #define assert(condition) ((condition) ? true : assert_proc(__LINE__, __FILE__, #condition))#endifinline bool assert_proc(int line, char *fn, char *condition){ std::cout << "\nAssertion failed: " << condition << ", file " << fn << ", line " << line << ".\n"; throw *new FailedAssertion(line, fn, condition); return false; // to please the compiler}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -