The C Standard [ISO/IEC 9899:2011] enumerates several instances where the behavior of accessing an object or function expanded to be a standard library macro definition is undefined.
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <myassert.h> #include <assert.h> void fullAssert(int e) { assert(0 < e); // invokeInvoke standard library assert() (assert)(0 < e); // assert() macro suppressed, calling function assert() } |
...
The programmer should place nonstandard verification in a function that does not conflict with the standard library macro assert
, for —for example, myassert()
.
Code Block | ||||
---|---|---|---|---|
| ||||
#include <myassert.h> #include <assert.h> void fullAssert(int e) { assert(0 < e); // standardStandard library assert() myassert(e); // well Well-defined custom assertion function } |
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
MSC38-C | low | unlikely | medium | P2 | L3 |
Related Guidelines
...
...