使用gcc4.8.5编译时,我收到以下警告:
Boolean_t bsnap_isFileExtensionValid (const char *suffix)
{
.......
.......
.........
strncpy (gbsnapSuffix, suffix,/*sizeof MAXPATHLEN*/(suffix ));
}
warning: argument to 'sizeof' in 'char* strncpy(char*, const char*, size_t)' call is the same expression as the source; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess]
strncpy (gbsnapSuffix, suffix,sizeof(suffix ));
如何解决此类警告? 我是否需要禁用编译选项?