免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 767 | 回复: 0
打印 上一主题 下一主题

常用的warning [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-17 15:18 |只看该作者 |倒序浏览
    *
      warning: "/*" within comment
  举例: /************************************************/
         /*
         /*  save snmp entry data
         /*  add by Tina Lee 2003/7/11
         /*************************************************/
  说明:意思是说/* */ 中间又包含了/*
  修改:改成这样就好了
         /************************************************
          *
          *  save snmp entry data
          *  add by Tina Lee 2003/7/11
          *************************************************/   
            
         
    *
      warning: no previous prototype for
      'get_char_for_sta'
  举例:无
  说明:函数没有声明,只有定义
  修改:在相应的.h文件中添加该函数的声明。
  
  
  
    *
      warning: unused parameter 'mcb'
  举例:
        int ifnMenuQuit(MCB_T *mcb)
           {
             return QUIT;
            }  
  说明:因为函数参数中的mcb,在该函数中没有被使用,所以产生warning
  修改:对没使用的参数使用 para=para;
         int ifnMenuQuit(MCB_T *mcb)
           {
             mcb=mcb;   
   * Date: Sun, 15 Jul 2001 00:56:27 -0400
   * CC: gcc at gcc dot gnu dot org
   * References:
  > What is the rationale for this warning ? What can break or is it a
  > standards thing ?
  Imagine foo.h:
  blah blah blah
  Now bar.c:
  #include "foo.h"
  #include "grill.h"
  Now imagine a preprocessor that isn't smart enough to put
  the newline in for you...
  blah blah blah#include "grill.h"
  It may not include grill.h.
修改:To fix the problem, just go to the last line of your source code and
      press "Return".
    *
      warning: cast increases required alignment of
      target type
举例:
     #define OSPF_CRU_BMC_DWTOPDU(pu1PduAddr,u4Value) \
             *((UINT4 *)(pu1PduAddr)) = OSIX_HTONL(u4Value);
说明:这个问题比较难解决,可以不做修改,因为如果有alignment error的话会进入异常处理,
      异常处理会解决这个问题。现在修改的方法是使用memcpy,一个字节,一个字节的拷贝。不知道
      该方法是否可行。
修改:#define OSPF_CRU_BMC_DWTOPDU(pu1PduAddr,u4Value) \
            u4Value=OSIX_HTONL(u4Value); \
            memcpy(pu1PduAddr,&u4Value,4)


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/35795/showart_691770.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP