std::assert 发生了什么
问题说明
这个答案和大量重复表明我应该使用 #include <c*>
对于我从 C 代码中提取的 C 头文件,我应该用 std::*
调用它们.
This answer and it's multitude of duplicates indicate that I should be using #include <c*>
for the C headers that I pull from in C code, and that I should be calling them with std::*
.
我一直在这样做,但我注意到一个例外.std::assert
似乎没有被定义,即使我正确地#include
.
I have been doing that but I notice an exception. std::assert
doesn't seem to be defined, even when I correctly #include <cassert>
.
这是怎么回事?这是实施疏忽,还是实际例外?
What's going on here? Is this an implementation oversight, or an actual exception?
正确答案
assert
是一个宏,而不是一个函数.因此,它需要与普通的旧 assert(condition)
一起使用.
assert
is a macro, not a function. Hence, it needs to be used with plain old assert(condition)
.
这是一个支持链接:http://en.cppreference.com/w/cpp/错误/断言.
这篇好文章是转载于:编程之路
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 编程之路
- 本文地址: /reply/detail/tanhcakfbh
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20