I have the following:
static unsigned int *tick = NULL;
...
if (tick == NULL)
tick = calloc(MAX_PORT,sizeof(unsigned int));
...
which functionally works as expected but coverity complains with: Parse warning (PW.INCOMPATIBLE_ASSIGNMENT_OPERANDS) 1. incompatible_assignment_operands: a value of type "int" cannot be assigned to an entity of type "unsigned int *" and I don't entirely understand why
The error message suggests that Coverity thinks that calloc
returns an int
,
which can happen if you haven't included stdlib.h
(for calloc)
in the older C.
But this is not allowed in modern C (i.e., no implicit declarations allowed in C99 and above).