> 10). In this error:
>
> + elog(ERROR, "unsupported type %d for rand_array function.",
> + datatype);
>
> "datatype" is of type Oid, which is unsigned, and so it should use
> "%u" not "%d". Also, as above, it should not end with a period, so it
> should be:
>
> + elog(ERROR, "unsupported type %u for rand_array function",
> + datatype);
I remember my IDE could detect such issue before, but failed this
time. I just checked more today and it is still failing. Looks the
checker is not stable and I can't find out the reason so far.
main.c
#include <stdio.h>
int main(int argc, char *argv[])
{
unsigned int i = 0;
int x = 2;
printf("i = %d\n", i);
printf("i = %u\n", x);
return 0;
}
All the following commands succeed without any warnings.
clang -O0 -g main.c -o main -Wall -Wformat
gcc -g main.c -o main -Wall -Wformat
scan-build clang -g main.c -o main -Wall -Wformat
cppcheck main.c
clang: 18.1.6
gcc: 13.3.0
Only "cppcheck --enable=all main.c" catch the warnning.
Any hints on this will be appreicated.
--
Best Regards
Andy Fan