编写dtuserver时出现的一些问题

来源:互联网 发布:电脑midi软件 编辑:程序博客网 时间:2024/06/06 08:59

 1、warning: argument to ‘sizeof’ in ‘memset’ call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]

在使用memset时,传参传的是一个char * argument,但是在memset中使用sizeof()时,直接使用了sizeof(argument),因为这是一个指针,所以永远是使用sizeof()永远是4个字节,应该使用的是sizeof(*argument)


2、warning: null argument where non-null required (argument 2) [-Wnonnull]
  (1)、 strcpy( g_detRes.m_ttc_tp           ,NULL);set the first argument to a NULL pointer

(2)、 strcpy( g_detRes.m_ttc_tp           ,“NULL”);set the first argument  to a NULL string