我正在使用Objective-C断言的NSAssert宏,并且这是执行此操作的常规方法。 但它在C函数中不起作用。我应该使用什么?C中断言的常规方式是什么?
5
A
回答
7
NSCAssert()
(也NSCAssert1()
...高达NSCAssert5()
)
11
#include <assert.h>
...
assert(<expression>);
4
void assert(int expression); If expression evaluates to 0 (false), then the expression, source code filename, and line number are sent to the standard error, and then calls the abort function. If the identifier NDEBUG ("no debug") is defined with #define NDEBUG then the macro assert does nothing.
例子:
assert(x != 0);
注:包括assert.h
相关问题
- 1. 在GraphEngine中表示关系的最常规方式是什么
- 2. Xpath的错误而在soapUI的/常规断言(通过响应XML断言在常规方法的元素)
- 3. 什么是Java中使用断言的
- 4. 的soapUI断言其中value是常规保留字
- 5. 什么是POGO在常规
- 6. 什么是Java中的“常规文件”?
- 7. 断言numpy.array是否相等的最好方法是什么?
- 8. 什么是更好的空参数检查,断言或异常?
- 9. 什么是断言失败的原因
- 10. 这是什么##模式在C语言中的意思是
- 11. 非常规语言与常规语言的连接总是不规则?
- 12. 在defmacro中指出错误的常规方法是什么?
- 13. C++语言中`::`是做什么的?
- 14. 为什么我们的Hamcrest断言不被认为是规则S2699的有效断言?
- 15. 什么语言是c#?
- 16. WS-I BP2012断言是什么意思?
- 17. 为什么Q_ASSERT而不是断言
- 18. 是什么让CLR显示断言?
- 19. Phpstorm中的方言是什么
- 20. Drools中的Mvel方言是什么?
- 21. 从常规集中提取单个值的最佳方式是什么?
- 22. 这个代码在Objective-C或C语言中的规则语法是什么?
- 23. 检查Application Insights Analytics查询语言中是否存在另一个表中的常规方法是什么?
- 24. 什么是unix上的常规文件
- 25. 什么是写作的常规动作
- 26. c#:什么是常量表达式?
- 27. 根据S_ISREG C/C++,“常规文件”是什么意思?
- 28. 如何判断Xcode的异常断点是什么异常?
- 29. 什么是C#实现这个Fortran语言片断
- 30. 以下是C语言代码片断在做什么?
另请注意http://vgable.com/blog/2008/12/04/nsassert-considered-对'assert(x!= 0 &&“是什么嘿? 。 – 2012-09-22 17:33:30