Hi,
this is a part of my command decoder:
const char Command_D[] = {"D"}; //Command in Memory u8 In_Command[17]; //Command from USART
if (strcmp(Command_D, In_Command) == 0) { Run_Dump(); }
The code is compiled correctly and even works correctly, but the compiler says:
warning: #167-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
I don't want to see a warning for each command to be decoded. So how can I work around this issue?
the compiler warning is quite clear: what does U8 stand for?
I don't want to see a warning for each command to be decoded
No. this if a compilation time warning, not a runtime warning!
Hi, you may disable the warning in the compiler settings www.keil.com/.../armccref_chdebied.htm Or you may just cast the parameters to the right type
//int strcmp ( const char * str1, const char * str2 ); if (strcmp((const char*)Command_D, (const char*)In_Command) == 0) { Run_Dump(); }
And make sure, that you understand, what you are doing...
as I don't want to switch off the warnings I checked the cast and it worked out fine.
Thanks!
Rather than casting, why not just define things to the appropriate type in the first place?!
See my posts of 5-May-2009 08:58 GMT and 6-May-2009 00:24 GMT in this thread: http://www.keil.com/forum/docs/thread14769.asp