我正在使用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