Please note that this is not a question on C++, but on plain C
在Rust中有一个方便的宏unimplemented!()
,可以让运行时崩溃,在函数未实现时使用.
我基本上已经在我的C代码中使用assert (false)
来模拟它.这不适用于发布版本.
相对于exit(-1)
,我更喜欢assert(false)
,因为我在调试器中找到了正确的位置.
我找到了Function not implemented macro?,它看起来不错,但crash
宏没有定义,至少在我的Cang-GCC设置中是这样.