由于错误的strcmp参数处理产生的警告 [英] Warning generated due wrong strcmp parameter handling
本文介绍了由于错误的strcmp参数处理产生的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我有一个
unsigned char * pMyPtr
分配到一些东西。
assigned to something.
然后我想用这个比较的任意字符串
Then I want to compare this to an arbitrary string with
strcmp(const char* , const char* )
但是,当我做到这一点,铛编译器告诉我
But when I do that, clang compiler tells me
警告:传递(又名无符号的char *')类型为为const char *'的参数指针为整数类型用不同的符号之间进行转换
我如何删除这个警告?
推荐答案
通过所有意见的问题,我觉得我失去了一些东西。
With all the comments to the question, I feel like I'm missing something.
我知道的演员都是不合时宜的,但下面一个简单的解决方法?
I know that casts are unfashionable, but isn't the following a simple workaround?
strcmp((const char*) pMyPtr , whatever_is_being_compared)
这篇关于由于错误的strcmp参数处理产生的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文