Here is the code:
char path = "/temp/abc";
if (mkfifo(path, S_IRWXU) != -1)
{
/* Other codes. */
}
For the if check, I got Klocwork misra:
Operand of bitwise operation has type 'int' instead of 'unsigned integer'
And at the same line, lint says:
Violates MISRA 2004 Required Rule 10.1, Prohibited Implicit Conversion: Signed versus Unsigned
But I understand the second argument taken by mkfifo is of type mode_t, which should actually be an unsigned integer. Thus as we know
#deinf S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC)
there should be no problem.
Any idea why I got such warnings?
I don't know what Klocwork is, but my guess is that S_IRWXU and the other constants are defined either as enums, or as C preprocessor #defines to integer literals; in both case they would thus have the type [signed] int; hence the mismatch.