Alerts of both rules are triggered even if no C-style array or string is directly used. It may also be relevant that the usage of the # operator is covered by rule M16-3-2.
Example
#include <cassert>
#define ASSERT(expr) ((expr) ? static_cast<void>(0) : [] { assert(false && #expr); }())
class a_class
{
public:
void some_operator()
{
ASSERT(flag_);
}
private:
bool flag_ = false;
};
int main()
{
assert((false) && "A way to add an assert message");
a_class instance;
instance.some_operator();
}
A27-0-4 and A18-1-1 alerts are signaled on ASSERT(flag_); as well as assert((false) && "A way ... message");
Affected rules
A27-0-4
A18-1-1
Description
Alerts of both rules are triggered even if no C-style array or string is directly used. It may also be relevant that the usage of the # operator is covered by rule
M16-3-2
.Example
A27-0-4
andA18-1-1
alerts are signaled onASSERT(flag_);
as well asassert((false) && "A way ... message");