打印

xc8编译器对指针的处理是怎样做的,我这个代码警告说有冲突

[复制链接]
2490|5
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
PIC16F883,MPLAB X IDE在调用该函数是,编译出现警告,我想搞明白是为什么?求助大神啊,新人求指点
unsigned char Check_Cmd(unsigned char *Ack,unsigned int Waittime)
{
           char *Strx= NULL;
        unsigned char i;
        unsigned int  Acklen;
        CommRecBufferTail2=0;
        for(i=0;i<10;i++)
                receive_cmd[i]=0;
        if(Waittime)                //ÐèÒªµÈ´ýÓ¦´ð
        {
                while(--Waittime)        //µÈ´ýµ¹¼Æʱ
                {
                        Delay_100us(1);
                                Acklen=strlen(Ack);
                                if(CommRecBufferTail2>=Acklen)
                                {
                                        Strx=strstr((const char*)receive_cmd,(unsigned char*)Ack);
                                        if(Strx)
                                        {       
                                                break;
                                        }
                                }
                }
        }
        return (unsigned char*)Strx;
}

wifi.c:176: warning: (358) illegal conversion of pointer to integer
wifi.c:190: warning: (361) function declared implicit int
wifi.c:201: warning: (359) illegal conversion between pointer types
pointer to const unsigned char -> pointer to unsigned char
wifi.c:210: warning: (359) illegal conversion between pointer types
pointer to const unsigned char -> pointer to unsigned char
wifi.c:226: warning: (359) illegal conversion between pointer types
沙发
JY-DX-JY| | 2016-1-15 13:01 | 只看该作者
是警告。看不出是哪一行

使用特权

评论回复
板凳
奥卡姆剃刀|  楼主 | 2016-1-15 13:45 | 只看该作者
说的是这个个有冲突。

QQ截图20160115134443.png (114.2 KB )

QQ截图20160115134443.png

使用特权

评论回复
地板
奥卡姆剃刀|  楼主 | 2016-1-15 13:47 | 只看该作者
行号对应上面的,基本全是这个问题。

使用特权

评论回复
5
JY-DX-JY| | 2016-1-15 13:54 | 只看该作者
奥**剃刀 发表于 2016-1-15 13:47
行号对应上面的,基本全是这个问题。

char *Strx= NULL;
return (unsigned char*)Strx;
你这儿转换了一下,你一开始就定义成无符号的试下。
可是警告提示违法的转换指针 to 整形,很奇怪。

使用特权

评论回复
6
GeekyGeek| | 2016-1-16 13:17 | 只看该作者
可以试试将char *Strx= NULL; 改为 char *Strx;

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

14

主题

289

帖子

4

粉丝