Will the macro `assert` be removed in C++20?

367 Views Asked by At

According to cppreference, assert will be used as a C++ attribute.

However, there already exist tons of projects heavily dependent on the macro assert, is there any bad effect?

2

There are 2 best solutions below

0
On BEST ANSWER

The new use of assert won't cause any problems, because it is not followed by a ( and therefore the function-style macro assert(blah) won't be invoked.

0
On

No. The proposal p0542r5 which introduces C++20 contracts says:

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.