[英]Will the macro `assert` be removed in C++20?
According to cppreference , assert
will be used as a C++ attribute. 根据cppreference , assert
将用作C ++属性。
However, there already exist tons of projects heavily dependent on the macro assert
, is there any bad effect? 但是,已经有很多项目严重依赖于宏assert
,是否有任何不良影响?
No. The proposal p0542r5 which introduces C++20 contracts says: 没有 。引入C ++ 20合同的提案p0542r5说:
Note that while
assert(expression)
would expand as a function-like macro with the appropriate header,assert:
is not a function-like invocation, so does not expand. 请注意,虽然assert(expression)
将扩展为具有适当头的类函数宏,但assert:
不是类似函数的调用,因此不会扩展。
assert
的新用法不会导致任何问题,因为它后面没有(
因此函数式宏assert(blah)
不会被调用)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.