I use strlen()
call all over my project, until now I compiled my project without -Wall
compiler option. But when I start using -Wall
I face so many compiler warning. 80% are the strlen char *
vs const char *
warning.
I am aware of type casting all strlen()
calls. Is there any other way that I can suppress the following warning?
./Proj.c:3126: warning: pointer targets in passing argument 1 of
'strlen' differ in signedness`
C:/staging/usr/include/string.h:397: note: expected 'const char *' but
argument is of type 'unsigned char *'`
There's always the option to do :
This way you don`t have to add a conversion everywhere in your code.
Although the question remains, why are you using unsigned char? I suppose it`s a byte array for data packets over networking, in that case you should take care of the length in the protocol anyways.