The literal 0 is assigned to or compared with a pointer, where NULL says it is a pointer
What it finds
char *p = 0; or if (q == 0): the literal is a null pointer here, which NULL says plainly.
From the rule's source, zero_as_null_pointer.rs.
#include <stddef.h> int empty(const char *s){ const char *end = 0;tx0 reports: 0 stands for a null pointer here; NULL says so if (s == 0)tx0 reports: 0 stands for a null pointer here return 1; return end == NULL;} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/c:zero-as-null-pointer" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/c:zero-as-null-pointer] reason="..."tx0 explain tx0/c:zero-as-null-pointer shows the same in the terminal. Found a false positive? Report it.